COSC 300: Advanced Data Structures

Homework Assignment #4

Due: 10/22/2009

  1. Describe how to implement a priority queue using a Binary Search Tree (BST). What are the asymptotic average case running times of the two main priority queue operations?

  2. Show the results of performing the following operations on a binomial queue. A letter, i.e., 'A', means insert 'A' into the heap. An asterisk, '*' means to remove the largest item from the heap. Show your work at each step and indicate what the results of each remove operation are. Use the standard alphabetic ordering, so Z > A.
    H E L * L O * W O R * * L D
    

  3. Describe an efficient algorithm for converting a min heap to a max heap. What is the asymptotic worst case running time for your algorithm?

  4. Give the definition for a greedy algorithm, a brute-force algorithm, a divide-and-conquer algorithm, and a dynamic programming algorithm. Give one example of each type of type of algorithm.

  5. State what's wrong with the following recursive function:
    int foo(int x) {
      return (x == 0 ? 1 : foo(x-2) + foo(x-1) + 1);
    }
    

  6. Bonus trivia question: Who created the Quicksort algorithm? In what journal was it first published and it what year?
    Last modified: Oct. 12, 2009
    Dr. Donald L. Simon, simon@mathcs.duq.edu