subject

The is a sum-the-data-in-the-tree question. it asks whether a method, sumall() is a well-written recursive method. you will see three different versions of this question throughout the exam, but the opening assumptions, are identical for all such versions. the only difference between the various questions is the code that implements the method : the general tree in this problem is assumed to be physical, i. e., there is no lazy or soft deletion designed into this tree. we are considering a recursive work-horse method to sum all the (assumed) integer data of the sub-tree. the sub-tree is specified by the root pointer passed in. as usual, some client would pass a root to this method, then this recursive method would generate other (child or sibling) roots to pass to itself when recursing. the members sib and firstchild have the same meanings as in our modules. true of false: the method, as defined below, is a good recursive method for summing the data of the sub-tree, based at the root node passed in. to be true, it must satisfy all the following criteria. if it misses one, it is false: it gives the right sum for the sub-tree, that is, it does not miss counting any data. it does no unnecessary work, micro-management or superfluous testing. it covers all situations (empty trees, null roots, handles all the children, treeclass: : sumall(node *root){ int sibsum, thissum, childrensum; if (root == null) return 0; sibsum = sumall(root-> sib); childrensum = sumall(root-> firstchild); thissum = root-> data; return childrensum + sibsum + thissum; }hint: there are three true-false questions that start out the same in this exam, but each has a different method definition. you may want to come back and review your answer to this question after seeing the other method definitions. only one of the three is true, and the other two are false. a. trueb. false

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
Program using c++ only on visual studio pig is a simple two player dice game, played with one die. the first player to reach or surpass 50 is the winner. each player takes a turn rolling the dice. they add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. the risk being they could lose the amount they’ve accumulated into the pot. the rules for each player’s die roll. 1. roll the dice. a. if user rolled a 1, i. the pot gets set to zero ii. the other player goes to step 1. b. a roll of 2-6 is added to the pot. 2. user can choose to hold or roll again. a. choice roll. return to step 1. b. choice hold. i. increment player score by the pot amount. ii. pot gets set to 0. iii. second player gets to roll and goes to step 1. program requirements: ● before each opponent begins ○ output the score for the person and the computer. ○ output the opponents whose turn is beginning and ask the user to hit enter to continue. ● with each dice roll. ○ output the die value, and amount of the round pot. ○ if it’s the users roll ask if they want to roll again ( r ) or hold ( h ). your program should allow r, r, h or h as valid input. if input is anything else, ask the user again until valid input is obtained. ○ the ai will continue playing until the round pot is 20 or more. ● once a player’s score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. ● once there is a winner ○ score totals are output along with who the winner was. user or computer ○ player is asked if they want to play again y or n. valid input should be y, y, or n, n. ● when a new game starts the starting roll goes to the player that did not roll last. if the user rolled last in the previous game, then the computer rolls first and vice versa. when the program first begins, the player will make the first roll of the first game. development notes : ● you will need a way to roll dice in your program. the rand() function works well, but returns an integer. if we want numbers 0 – 9 we can get the value modulus 10. ● call srand() with a value to seed it. it’s common to seed it with the current computer clock, include ctime, and then call srand(time(
Answers: 1
question
Computers and Technology, 24.06.2019 11:30
What does the https: // mean when you type in a website
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
question
Computers and Technology, 24.06.2019 16:50
Ideally, the backrest is tilted back slightly, so when you turn the wheel your shoulders are the seat.
Answers: 2
You know the right answer?
The is a sum-the-data-in-the-tree question. it asks whether a method, sumall() is a well-written rec...
Questions
question
Mathematics, 24.06.2019 23:30
question
Mathematics, 24.06.2019 23:30