Problem 24
Mark the answers true or false as follows: A. True B. False Binary search trees are ordered.
Problem 25
Mark the answers true or false as follows: A. True B. False On average, searching in a binary search tree is faster than searching in an array-based list.
Problem 26
Mark the answers true or false as follows: A. True B. False On average, searching in a binary search tree is faster than searching in a list.
Problem 27
Mark the answers true or false as follows: A. True B. False A binary search tree is always balanced.
Problem 28
Mark the answers true or false as follows: A. True B. False Given the number of nodes and the number of levels in a binary search tree, you can determine the relative efficiency of a search in the tree.
Problem 29
Mark the answers true or false as follows: A. True B. False Insertion in a binary search tree is always into a leaf node.
Problem 30
Mark the answers true or false as follows: A. True B. False A binary search tree is another implementation of a sorted list.
Problem 32
The following algorithm (used for Exercises \(31-33\) ) is a count-controlled loop going from 1 through 5 . At each iteration, the loop counter is either printed or put on a stack, depending on the result of Boolean function RanFun0. (The behavior of RanFun() is immaterial.) At the end of the loop, the items on the stack are popped and printed. Because of the logical properties of a stack, this algorithm cannot print certain sequences of the values of the loop counter. You are given an output and asked if the algorithm could generate the output. Respond as follows: A. True B. False C. Not enough information The following output is possible using a stack: 13542 .
Problem 35
The following algorithm (used for Exercises 34-36) is a count-controlled loop going from 1 through 5 . At each iteration, the loop counter is either printed or put on a queue, depending on the result of Boolean function RanFun(). (The behavior of RanFun() is immaterial.) At the end of the loop, the items on the queue are dequeued and printed. Because of the logical properties of a queue, this algorithm cannot print certain sequences of the values of the loop counter. You are given an output and asked if the algorithm could generate the output. Respond as follows: A. True B. False C. Not enough information The following output is possible using a queue: 13542 .
Problem 36
The following algorithm (used for Exercises 34-36) is a count-controlled loop going from 1 through 5 . At each iteration, the loop counter is either printed or put on a queue, depending on the result of Boolean function RanFun(). (The behavior of RanFun() is immaterial.) At the end of the loop, the items on the queue are dequeued and printed. Because of the logical properties of a queue, this algorithm cannot print certain sequences of the values of the loop counter. You are given an output and asked if the algorithm could generate the output. Respond as follows: A. True B. False C. Not enough information The following output is possible using a queue: 13513 .