Lecture Data structures and other objects using C++ - Chapter 12: Hash tables

Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common approach to the storing/searching problem. This presentation introduces hash tables. | Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common approach to the storing/searching problem. This presentation introduces hash tables. Hash Tables Data Structures and Other Objects Using C++ This lecture illustrates hash tables, using open addressing. Before this lecture, students should have seen other forms of a Dictionary, where a collection of data is stored, and each data item has a key associated with it. What is a Hash Table ? The simplest kind of hash table is an array of records. This example has 701 records. [ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] An array of records . . . [ 700] This lecture introduces hash tables, which are an array-based method for implementing a Dictionary. You should recall that we have seen dictionaries implemented in other ways, for example with a binary search tree. The abstract properties of a dictionary remain the same: We can insert items in the dictionary, and each item has a key associated with it. When we want to retrieve an item, we specify only the key, and the retrieval process finds the associated data. What we do now is use an array to implement the dictionary. The array is an array of records. In this example, we could store up to 701 records in the array. What is a Hash Table ? Each record has a special field, called its key. In this example, the key is a long integer field called Number. [ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] . . . [ 700] [ 4 ] Number 506643548 Each record in the array contains two parts. The first part is a number that we'll use for the key of the item. We could use something else for the keys, such as a string. But for a hash table, numbers make the most convenient keys. What is a Hash Table ? The number might be a person's identification number, and the rest of the record has information about the person. [ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] . . . [ 700] [ 4 ] Number 506643548 The numbers might be identification numbers | Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common approach to the storing/searching problem. This presentation introduces hash tables. Hash Tables Data Structures and Other Objects Using C++ This lecture illustrates hash tables, using open addressing. Before this lecture, students should have seen other forms of a Dictionary, where a collection of data is stored, and each data item has a key associated with it. What is a Hash Table ? The simplest kind of hash table is an array of records. This example has 701 records. [ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] An array of records . . . [ 700] This lecture introduces hash tables, which are an array-based method for implementing a Dictionary. You should recall that we have seen dictionaries implemented in other ways, for example with a binary search tree. The abstract properties of a dictionary remain the same: We can insert items in the dictionary, and each

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.