CSCI 131
Fall 2003
Final Exam


  1. [10 pts] Describe what occurs in each of the following C++ code segments
  2. [4 pts] Define Abstract Data Type

  3. [6 pts] Using the definition above, describe either the ADT Queue or ADT Stack.

  4. [15 pts] For the ADT discussed above, implement this ADT as a C++ class based upon dynamic memory.

  5. [ 5 pts] Compare and contrast the ADT vector (array) and the ADT Stack.

  6. [5 pts] Give an example of an algorithm which runs in O(1), O(lg n), O(n) and O(n2).

  7. [2 pts] Define a recursive function

  8. [3 pts] Describe the conditions necessary to correctly implement a recursive function.

  9. [7 pts] Implement a recursive function to calculate n!.

  10. [ 3 pts] In the function above, identify each of the conditions from the previous question.

  11. [10 pts] Given a singly linked list, write a recursive function that will print the list out in reverse order.

  12. [10 pts] Given a singly linked list, write a stack based function that will print the list out in reverse order.