Problem 40
Are short-answer questions. Write an algorithm that sets bottom equal to the last element in the stack, leaving the stack unchanged.
Problem 42
Are short-answer questions. Write an algorithm that sets last equal to the last element in a queue, leaving the queue empty.
Problem 45
Are short-answer questions. Write an algorithm replace that takes a stack and two items. If the first item is in the stack, replace it with the second item, leaving the rest of the stack unchanged.
Problem 47
Are short-answer questions. Draw the binary search tree whose elements are inserted in the following order: \(\begin{array}{ccccccccc}50 & 72 & 96 & 107 & 26 & 12 & 11 & 9 & 2 \\ 10 & 25 & 51 & 16 & 17 & 95 & & & \end{array}\)
Problem 67
Are short-answer exercises. Can you think of a way to keep the user from doing an insertion or deletion during an iteration?
Problem 68
Are short-answer exercises. Distinguish between value and reference parameters.