a. If you were to implement a map using a balancing binarysearch tree, what would be the average time to lookup a key?
b. would that be better or worse than a hash table with a”good”(distributing keys mostly) hashing function?
Answer
(a) On implementing a map using a balancing binary search tree,the average time to lookup for a element in the tree is O(log n).The best case has a lookup time complexity of O(1). This is thecase when the element we are looking for is on the root of thetree. Now the worst case can be O(log n). The worst case
OR
OR