Homework Assignment 8


Assignment

  1. (50 points) Explain how to use an AVL tree or a red-black tree to sort n comparable elements in O(n log n) time in the worst case.
    1. Provide and explain pseudocode
    2. Statement and proof of time complexity. Be clear of the assumptions on the ADT implementations.
    3. Statement and proof of memory complexity. Be clear of the assumptions on the ADT implementations.
  2. (50 points) Suppose we are given two n-element sorted sequences A and B each with distinct elements, but potentially some elements that are in both sequences. Describe an O(n)-time method for computing a sequence representing the union A ∪ B (with no duplicates) as a sorted sequence.
    1. Provide and explain pseudocode
    2. Statement and proof of time complexity. Be clear of the assumptions on the ADT implementations.
    3. Statement and proof of memory complexity. Be clear of the assumptions on the ADT implementations.
  3. Bonus. (10 points) Describe and analyze an efficient method for removing all duplicates from a collection A of n elements.
    1. Provide and explain pseudocode
    2. Statement and proof of time complexity. Be clear of the assumptions on the ADT implementations.
    3. Statement and proof of memory complexity. Be clear of the assumptions on the ADT implementations.


General Instructions, Turning in assignments, and Grading

General Instructions

Turn in Instructions

Each assignment will be turned in in class (hard copy). Assignments are due BEFORE, let me repeat, before class starts. This does not mean one minute after class starts. Details:

Grading