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, 21.06.2019 17:10
Type the correct answer in the box. spell all words correctly. which technology should andrea use? andrea owns a potato chips manufacturing unit. she has been getting complaints about the quality of the chips. she knows her product is good. she realizes that she needs to change the way the chips are packaged. she should use technology, which uses gases, such as carbon dioxide or argon, to create an air cushion, which improves the shelf life of products.
Answers: 2
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
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, 02.03.2021 08:50
question
Mathematics, 02.03.2021 08:50
question
Mathematics, 02.03.2021 08:50
question
Biology, 02.03.2021 08:50
question
Mathematics, 02.03.2021 08:50
question
Mathematics, 02.03.2021 08:50
Questions on the website: 13722363