a. | O(1) |
b. | O(log(n)) |
c. | O(n) |
d. | O(n*log(n)) |
e. | O(n*n) |
For each action below, state the smallest of the functions above that characterizes the worst case running time of the action. In other words, if the action has a worst case running time of 4n+3, then the answer is c, not d or e.
Question 9: | Inserting an item into an unsorted linked list. |
Question 10: | Inserting an item into a hash table with n elements in it. |
Question 11: | Inserting an item into a binary search tree with n elements in it. |
Question 12: | Inserting an item into an AVL tree with n elements in it. |
Question 13: | Inserting an item into a splay tree with n elements in it. |
Question 14: | Inserting n items into an empty splay tree. |
Question 15: | Performing a zig-zig rotation in a splay tree. |
Question 16: | Inserting an item into a heap with n elements in it. |
Question 17: | Inserting n items into an empty AVL tree. |
Question 18: | Inserting n items into an empty binary search tree. |
Question 19: | Printing out the elements of an AVL tree (without flink and blink pointers) in sorted order . Assume that there are n elements in the AVL tree. |
Question 20: | Printing out the elements of a splay tree (with flink and blink pointers) in sorted order. Assume that there are n elements in the splay tree. |