"数据结构英文教学课件:哈希搜索及碰撞解决策略_03.pdf"

版权申诉
0 下载量 142 浏览量 更新于2024-03-26 收藏 152KB PDF 举报
Data structure is a fundamental concept in computer science that involves organizing and managing data effectively. Searching is one of the key operations in data structures, and in this tutorial, we will focus on hashing as a searching technique. Hashing is the process of finding a record using a computation that maps its key value to a position in an array. This technique uses a hash function to determine the index where the record is stored in the array. Hash functions play a crucial role in hashing as they convert a key value into a unique index within the array. There are two main types of hashing: open hashing and closed hashing. In open hashing, also known as separate chaining, collisions are resolved by storing multiple records in the same index of the array. This approach is suitable when there are many collisions, as it allows for efficient storage and retrieval of records. On the other hand, closed hashing, also known as open addressing, resolves collisions by storing the record in a different location within the array. This approach requires probing techniques to search for an empty slot in the array to store the record. Closed hashing is more challenging than open hashing but can be more efficient in terms of memory usage. Overall, hashing is a powerful searching technique that is commonly used in data structures to quickly retrieve records based on their key values. By understanding how hashing works and the different collision resolution policies, computer scientists can improve the efficiency and performance of data retrieval operations.