Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

Show Theorem 3.3. Hint: Show that x1 f (x j r ) 1 r2 f (x j r 2).

Answered: 1 week ago

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago