Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Family Tree file in above pic Use the skeleton code at the bottom to complete all the functions and the data structure design. int Factorial_nonRecur(int)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedFamily Tree file in above pic

Use the skeleton code at the bottom to complete all the functions and the data structure design. int Factorial_nonRecur(int) Use a loop statement to implement the function. (4 pts) int Factorial_Recur(int) Use a recursive function to implement the function. (6 pts) This is a recursive function which displays each digit of an integer. For example, the following function call void displayEachDigitOfInt(int) displayEachDigitOfInt(54321); (6 pts) will display 1 2 3 4 5 Hint: When dealing with a string, we can use substr() to get a part of the string. For an integer, we can use the operators + -/ % to get the similar results. It returns the biggest integer in the array. Binary recursive function must be used to solve this problem. int getMax_BinRecur(int [], int) (8 pts) Hint: Have you noticed that when using binary recursive functions to process and array, we normally need to pass three arguments, i.e. the array name, the begin index and ending index, to the function. But from the perspective of the caller function, only the array name and the size of the array should be passed to the function. So we need a helper function, which passes the array name, begin index and ending index, to solve this problem. This helper function is the one which recursively calls itself. Design a data structure which allows us to implement a simplified family tree like the following figure. family tree.png In this family tree, Mary has two children, i.e. Mary and Michael. Michael has three children, i.e. John, Cindy and Paul. The requirements of this system are listed here. 1. The attributes of a person consists of ID, name, date of birth, gender (or sex), and address. 2. Each person can have unlimited amount of children. 3. The family tree can have unlimited level of hierarchy. Due to the limitation of time, only data structure (by using struct, array and/or array) is required in this test. That is, you do NOT need to provide any function, loop or if statements. Code base: int main() III display the integer which is equal to 5*4*3*2*1 cout

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

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

What number is one-tenth more than 0.10? Submit

Answered: 1 week ago