Homework Assignment 8
Assignment
-
(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.
- Provide and explain pseudocode
- Statement and proof of time complexity. Be clear of the assumptions on
the ADT implementations.
- Statement and proof of memory complexity. Be clear of the assumptions on
the ADT implementations.
-
(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.
- Provide and explain pseudocode
- Statement and proof of time complexity. Be clear of the assumptions on
the ADT implementations.
- Statement and proof of memory complexity. Be clear of the assumptions on
the ADT implementations.
-
Bonus.
(10 points) Describe and analyze an efficient method for removing all
duplicates from a collection
A of n elements.
- Provide and explain pseudocode
- Statement and proof of time complexity. Be clear of the assumptions on
the ADT implementations.
- Statement and proof of memory complexity. Be clear of the assumptions on
the ADT implementations.