Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 (48 points): A human pyramid is a formation of people where participants make a horizontal row along the ground, and then additional rows

image text in transcribedimage text in transcribed

Problem 1 (48 points): A human pyramid is a formation of people where participants make a horizontal row along the ground, and then additional rows of people climb on top of their backs. Each row contains 1 person fewer than the row below it. The top row has a single person in it. The image below depicts a human pyramid with four rows. Before you decide to participate in one of these, you may want to know how much weight you will be supporting B C DEF G HU Write a recursive program to compute the weight being supported by the knees of a given person in the human pyramid. We will define the weight on a given person Ps knees recursively to be Ps own weight, plus half of the weight on the knees of each of the two people directly above P. For example, in the pyramid figure at right, the weight on the knees of person I below is I's own weight, plus half of the weight on the knees of persons E and F The weight on the knees of persons E and F can be computed recursively using the same process; for example, the weight on the knees of person E is E's own weight, plus half of the weight on the knees of person B, plus half of the weight on the knees of person C. If a given person does not have two people directly above them, any "blank" or "missing" persons should be ignored. For example, the weight on the knees of person F in the figure at right is F's own weight, plus half of the weight on the knees of person C. No truncation/rounding of the result should be done during any of these recursive calculations Sample output

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_2

Step: 3

blur-text-image_3

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

Students also viewed these Databases questions