πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      What is the worst-case time complexity for inserting an

      element into a hash table that uses separate chaining for collision resolution?
      A O(1) Correct Answer Incorrect Answer
      B O(log n) Correct Answer Incorrect Answer
      C O(n) Correct Answer Incorrect Answer
      D O(n log n) Correct Answer Incorrect Answer
      E O(n^2) Correct Answer Incorrect Answer

      Solution

      In the worst case, all elements hash to the same bucket, resulting in a linked list of size n, making insertion O(n).

      Practice Next
      ask-question