Question:
What is the time complexity of inserting a new key into a Hash Table with \(n\) elements using chaining, in the average case? (Variant 90)
चेनिंग का उपयोग करके \(n\) तत्वों वाले हैश टेबल में औसत स्थिति में एक नई कुंजी डालने की समय जटिलता क्या है? (प्रकार 90)
Options:
- \(O(1)\)
- \(O(n)\)
- \(O(\log n)\)
- \(O(n^2)\)
- \(O(1)\)
- \(O(n)\)
- \(O(\log n)\)
- \(O(n^2)\)
Correct Answer: a)
Explanation:
Under the assumption of simple uniform hashing, inserting a key at the head of a linked list in its hash bucket takes constant \(O(1)\) time.
हैश टेबल में नए तत्व को बकेट लिंक्ड लिस्ट के शीर्ष पर जोड़ने में औसत समय \(O(1)\) लगता है।