L-6.1: What is hashing with example | Hashing in data structure

Gate Smashers
16 Jan 202105:53

Summary

TLDRIn this video, the concept of hashing is introduced, explaining its importance for competitive exams like GATE, NET, and PSU exams. Hashing is a method of storing and retrieving data efficiently in constant time using a hash table. The video covers key concepts such as search keys, hash tables, and common hash functions like K mod N, mid-square, and folding methods. It also explains the process of inserting, searching, and deleting data from the hash table. The concept of collisions is briefly mentioned, with a promise to address collision resolution in a future video.

Takeaways

  • 😀 Hashing is a crucial topic for competitive exams like GATE, NET, and PSUs, and also for college and university exams.
  • 😀 Hashing is a method used for storing and retrieving data in constant time, making data management efficient.
  • 😀 The main goal of hashing is to map larger data values into smaller, fixed-size values using a hashing function.
  • 😀 A search key is used to look up data in a hash table, which could be things like student registration numbers or passport numbers.
  • 😀 A hash table is an array-like data structure that allows efficient data insertion, deletion, and search operations.
  • 😀 Hash functions, such as K mod N and the mid-square method, are used to map keys to indices in the hash table.
  • 😀 In the K mod N function, the key is divided by N and the remainder is used as the index in the hash table.
  • 😀 The mid-square method involves squaring the key, extracting the middle part, and using it as the index in the hash table.
  • 😀 Collisions occur when two keys map to the same index, and resolving them is an important topic to be covered in future videos.
  • 😀 Hashing ensures constant time operations (O(1)) for insertion, deletion, and search by calculating the index based on a hash function.

Q & A

  • What is the main topic of this video?

    -The main topic of the video is hashing, including its concept, how it works, and its significance in exams like GATE, NET, and university exams.

  • Why is hashing considered an important topic in competitive exams?

    -Hashing is important because it frequently appears in competitive exams like GATE, NET, and various PSU exams, with at least one or two questions related to hashing.

  • What does the term 'hashing' refer to in the context of data storage?

    -Hashing refers to a method for storing and retrieving data from a database in constant time (O(1)), using a hash function to map larger values to smaller ones.

  • What is a hash table?

    -A hash table is a data structure that helps store data efficiently, with an array-like structure where keys are mapped to indices using a hash function.

  • What is the significance of a 'search key' in hashing?

    -A search key is a value used to look up or store data in a hash table. It can be a unique identifier such as a roll number or passport number.

  • What is the hash function 'K mod N' used for?

    -'K mod N' is a hash function used to map a key (K) to a position in a hash table, where N is the size of the table, by computing the remainder when K is divided by N.

  • How is the 'mid-square method' of hashing explained?

    -In the mid-square method, the middle digits of the square of a number are extracted to determine the hash value, which is used as the index in the hash table.

  • What happens in the 'folding method' of hashing?

    -In the folding method, a large key is divided into smaller parts, which are then added together to create a hash value that fits within the range of the hash table indices.

  • What is the concept of 'collision' in hashing?

    -A collision occurs in a hash table when two different keys are mapped to the same index. This is resolved through various techniques, which will be covered in the next video.

  • How does insertion, searching, and deletion in a hash table work in terms of time complexity?

    -Insertion, searching, and deletion in a hash table typically occur in constant time (O(1)), because each operation only requires calculating the hash value for the key.

Outlines

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Mindmap

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Keywords

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Highlights

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Transcripts

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード
Rate This

5.0 / 5 (0 votes)

関連タグ
HashingData StructuresCompetitive ExamsGATE ExamNET ExamPSU ExamsHash FunctionsCollision ResolutionDatabaseTech EducationComputer Science
英語で要約が必要ですか?