Presentation is loading. Please wait.

Presentation is loading. Please wait.

Foundations of Data Structures Practical Session #10 Hash Tables.

Similar presentations


Presentation on theme: "Foundations of Data Structures Practical Session #10 Hash Tables."— Presentation transcript:

1 Foundations of Data Structures Practical Session #10 Hash Tables

2 Hash Tables Definitions 2

3 3

4 Hash Tables Remarks: 4

5 Question 1 5

6 Time of searching depends on the load of the table and on the distribution of the Hash function Note: no delete function suggested! (as it changes the searching time, which will not be more dependent on the load factor. So open addressing is good for insert search (no deletion)) 6

7 Question 2 7

8 Question 2 - Solution 8

9 Question 3 Suggest how to implement Delete(k) function for a hash table, when using open addressing. 9

10 Question 3 Solution: Each table entry will contain a special mark to indicate if it was deleted. While searching for a key, if we encounter an entry which is marked as deleted, we continue to search. Note that when using this solution, the search time of an element is not dependent on the load-factor. 10

11 Question 3 11

12 Question 4 12

13 Question 4 – Naïve Solution 13

14 14


Download ppt "Foundations of Data Structures Practical Session #10 Hash Tables."

Similar presentations


Ads by Google