Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pizza Problem please use PYTHON and have screen shot of working function code A portion of the code has been provided just fill in the
Pizza Problem please use PYTHON and have screen shot of working function code A portion of the code has been provided just fill in the area that needs filled
For good feedback thanks!
Problem Statement: You are given a stack of n pizza boxes of the same s each containing 1 pizza. he pizzas in the boxes are sorted by increasing diameter the diameters are all at most 40cm. Give an algorithm for finding a pair of pizzas p1 and p2 on the stack whose diameters differ by at most 40/(n-1) cm. Input: The input will consist of two lines. On the first line is a single integer n, the number of pizzas. The second line contains n space-separated decimal numbers (not necessarily integers). output: The output will consist of two integers: the zero-based indices of the pl and p2. Note that there might be more than one pair of pizzas in the stack satisfying the constraints. Anyone ofthem is accepted as correct answer. Examples: Input 1 13 14 31 40 Output 1: 01 Explanation: The diameters 1 and 3 are a pair that differ by less than 40/(5-1) 10 cm. These two pizzas are located at positions 0 and 1. Note that "3 4" is also a correctStep 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