Final, CSCI 385, Fall 2005

  1. [10 points] Describe the ADT tree. Include in your discussion:
  2. [5 points] Give the binary search tree property. Give an example of a tree of height at least 3, that is a binary search tree.
  3. [5 poitns] Describe the ADT binary search tree.
  4. [5 points] Give an algorithm which will take an ordered array and insert the data into a BST with optimal height. (You might consider using a Queue to accomplish this.
  5. [5 points] Give an algorithm that will take a BST and insert the data into an ordered array.
  6. [5 points] Argue the performance and correctness of the previous algorithm.
  7. [5 points] Describe AVL trees. What is the goal of an AVL tree? How does an AVL tree achieve this goal? What is the cost of achieving this goal?
  8. [5 points] Describe what is happening in the following AVL rotation. Explain why this is happening, and how the AVL tree properties have been maintained.

  9. [5 points] Given the following declaration, write the C++ code to perform the above rotation.
    struct node{
        DataType  data;
        node * parent, * leftChild, * rightChild;
    };
        

     

     

     

    Please continue on the other side

     

     

     

     

  10. [5 points] Derive the performance of the following algorithm
    int foo(int x) {
        if(x < 4) {
            return x;
        } else {
            return( 2*foo(x/2) + 3*foo(x/4) + 3);
        }
    }
        
  11. [5 points] Describe the technique of divide and conquer.
  12. [5 points] Given an example of a divide and conquer algorithm.
  13. [10 points] Compare and contrast linked lists and one dimensional array.
  14. [5 points] Describe dynamic arrays. How are dynamic arrays different from arrays allocated at compile time? Describe the performance characteristics of dynamic arrays.
  15. [10 points] Select any sorting algorithm.
  16. [10 points] Describe Big-O notation. What does it measure? What does it do well and what does it fail to do. What assumption is implicit when Big-O notation is asked for?