Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Delete Operation in Hash Table | Data Structure
Play lesson

Data Structures | Python - Delete Operation in Hash Table | Data Structure

4.0 (0)
17 learners

What you'll learn

This course includes

  • 19.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

This video explains the process of deleting key-value pairs in hash tables, focusing on three scenarios of collision handling: no collision, chaining, and open addressing. In the first scenario, when there is no collision, the key-value pair is deleted by applying a hash function to the key, finding its index, and checking if the slot is empty. If the slot is not empty, the key is compared with the given key. If they match, the key-value pair is deleted; otherwise, a "Key not found" message is returned. The second scenario deals with collisions handled using chaining. In this method, each slot is a linked list. When a collision occurs, the linked list at the index is searched for the key. If the key is found, it is deleted; if not, a "Key not found" message is returned. The third scenario addresses open addressing, where collisions are handled by probing. If a collision happens, probing techniques like linear or quadratic probing are used to find an available slot. When deleting a key, the slot is marked as "deleted" instead of being emptied, to avoid breaking the probing sequence. If the key is found, it is deleted; if not, the search continues. If no key is found or an empty slot is encountered, a "Key not found" message is returned. Throughout the video, examples illustrate how each method works, providing a clear understanding of how to handle deletions in hash tables under different collision resolution techniques.

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere