Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. [12] Dan's favourite food is pizza. (If you haven't tried the Cow Pie pizza in DH, you should!) Imagine that every pizza in the
3. [12] Dan's favourite food is pizza. (If you haven't tried the Cow Pie pizza in DH, you should!) Imagine that every pizza in the world is a circle, with exactly five slices. For each slice, Dan gives the integer quality rating of the slice. We say that two pizzas are equivalent if one pizza can be rotated so that the quality of each corresponding slice is the same. For example, suppose that we had these two pizzas: (3,9, 15, 2,1) and (15,2, 1,3,9) These two pizzas are equivalent the sccond is a rotation of the first. However, the following two pizzas are not equivalent: (3,9,15, 2, 1) and (3,9,2, 15, 1) because no rotation of one pizza can give you the other. Here's another example of two pizzas that are not equivalent: (3,9, 15, 2,1) and (9, 15, 2, 1,50) We say that two pizzas are the same kind if they are equivalent. In Python, a pizza wil be represented as a tuple of 5 integers. Your task is to write the function num_pizza_kinds which determines the number of different kinds of pizzas in the list. Requirements: . Your code must be written in Python 3, and the filename must be pizza. py. We will grade only the num pizza kinds function; please do not change its signature in the starter code. include as many helper functions as you wish . You are not allowed to use the built-in Python dictionary. . To get full marks, your algorithm must have average-case runtime O(n). You can assume Simple Uniform Random Hashing Write-up: in your ps3.pdf/ps3.tex files, include the following: an explanation of how your code works, justification of correctness, and justification of desired O(n) average-case runtime
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started