2013 CS140 Final Exam Page Two


Question 4 - Binary Search Trees

Tell me in words how you delete a node from a binary search tree.

Question 5 - Stack em up.

The definition of a stack is in the cheat sheet. Implement the Push() and Pop() methods. As a reminder, when a stack is empty, top equals NULL.

Question 6 - Tree Traversals.

Your job is to perform a preorder and postorder traversal of the two trees below, where you print the node when you visit it.

Tree 1:
Tree 2:

Answer this question on the answer sheet, choosing from the following answers. Just give me the letter of the correct answer. They are in alphabetical order.

  • a -- D F H J K L N P R T V X
  • b -- D H F J K N P L R T X V
  • c -- D H F K N P L R T X V J
  • d -- D H F K N P L T X V R J
  • e -- D H L V K P T X N F R J
  • f -- F H D J K N L R P T X V
  • g -- F H D K N L R P X V T J
  • h -- F N J X H D T R P K V J
  • i -- F P H R V J K N X D T L
  • j -- J D F H T P L R K N V X
  • k -- J D H F T P L K N R V X
  • l -- J D T H P V F L R X K N
  • m -- J F D H R L K P N V T X
  • n -- J F R D H L V K P T X N
  • o -- J R V X T L P N K F H D
  • p -- J T V X P R L N K D H F
  • q -- J V K P R T D H X J N F
  • r -- L T D X N K J V R H P F
  • s -- N K X R L F V P H T D J
  • t -- N X T P K V L H D R F J
  • u -- V X T P R L N K J D H F
  • v -- X T V K N P L R H D F J
  • w -- X T V N P K L R H D F J
  • x -- X V N K R L P T H F D J
  • y -- X V R N K L P T F H D J
  • z -- X V T R P N L K J H F D