2

What is the worst-case complexity of dynamic hash where instead of chain-hashing there will be an AVL tree in each array element of the table?

If the hash-table wasn't dynamic, the WC complexity would be O(logn) for insert, find and delete. But how would the dynamic hash-table affect these complexities?

1
  • 1
    By "dynamic hash table," do you mean "a hash table with insertions and deletions allowed," or are you referring to something else? Commented May 21, 2014 at 23:15

1 Answer 1

0

With linear chaining, the worst case happens when (1) all elements hash to the same bucket, and (2) the client is looking for the last element in the bucket.

With AVL tree, the #1 part still stays the same, but the #2 part gets better because instead of searching in a (unsorted) linked list, we are now searching in a height balanced BST, which is an improvement from linear complexity to logarithmic complexity.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.