Question 12: Code the given problem using python The Physics teacher in Alexandra's class is teaching concepts of a bouncing ball. The rubber ball that she is using has the property that if the ball is dropped from height H then, it bounces back to maximum height H/F. So, after first bounce it rises up to maximum height H/F, after second bounce to maximum height H/F?, after third bounce to maximum height H/F3, and so on. The class has N children, and the teacher wants to select two children such that when the taller child drops the ball from his height, ball reaches a maximum height equal to the height of the shorter child after some (possibly zero) number of bounces. Note that zero bounces mean heights of the two children will be same. Given the heights of the children in the class Height[i), can you tell how many ways are there for the teacher to select two children for the demonstration? Note that when heights are same, the pair is only counted once (See input and output for further clarification).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please help me with Computer Engineering Question 

Question 12: Code the given problem using python
The Physics teacher in Alexandra's class is teaching concepts of a bouncing ball. The
rubber ball that she is using has the property that if the ball is dropped from height H
then, it bounces back to maximum height H/F. So, after first bounce it rises up to
maximum height H/F, after second bounce to maximum height H/F?, after third bounce
to maximum height H/F3, and so on.
The class has N children, and the teacher wants to select two children such that when
the taller child drops the ball from his height, ball reaches a maximum height equal to the
height of the shorter child after some (possibly zero) number of bounces. Note that zero
bounces mean heights of the two children will be same. Given the heights of the children
in the class Height[), can you tell how many ways are there for the teacher to select two
children for the demonstration? Note that when heights are same, the pair is only
counted once (See input and output for further clarification).
Input:
1
32
222
Output:
3
Transcribed Image Text:Question 12: Code the given problem using python The Physics teacher in Alexandra's class is teaching concepts of a bouncing ball. The rubber ball that she is using has the property that if the ball is dropped from height H then, it bounces back to maximum height H/F. So, after first bounce it rises up to maximum height H/F, after second bounce to maximum height H/F?, after third bounce to maximum height H/F3, and so on. The class has N children, and the teacher wants to select two children such that when the taller child drops the ball from his height, ball reaches a maximum height equal to the height of the shorter child after some (possibly zero) number of bounces. Note that zero bounces mean heights of the two children will be same. Given the heights of the children in the class Height[), can you tell how many ways are there for the teacher to select two children for the demonstration? Note that when heights are same, the pair is only counted once (See input and output for further clarification). Input: 1 32 222 Output: 3
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY