1 / 7

Appendix E-D Hashing – With chaining

Modified. Appendix E-D Hashing – With chaining. Chaining . The chaining method simply treats the hash table conceptually as an array of lists of individual elements Thus each hash value locates a list of all entries that hash to (collide at) that hash location .

vonda
Download Presentation

Appendix E-D Hashing – With chaining

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Modified Appendix E-D Hashing – With chaining

  2. Chaining • The chaining method simply treats the hash table conceptually as an array of lists of individual elements • Thus each hash value locates a list of all entries that hash to (collide at) that hash location. • These lists are usually linked (chained) lists. Java Software Structures, 4th Edition, Lewis/Chase

  3. 0 1 2 … The chaining method of collision handling Two variants: The table cells can contain the data being stored, or The table cells can contain only head pointers to the lists, with all data being stored in the list nodes. Pros and cons of each variant? N-1 Java Software Structures, 4th Edition, Lewis/Chase

  4. Basic operations • Insert • Find • Delete Lists can be ordered or not Java Software Structures, 4th Edition, Lewis/Chase

  5. Pros of chaining – compared to closed hashing • Hash table does not ever have to be expanded. • Performance degrades more slowly as table fills up. • Fewer (or no) empty table (data) spaces. • Insertion (at the head of list) is simple and takes constant time. • Deletion does not require special treatment. • No clustering Java Software Structures, 4th Edition, Lewis/Chase

  6. Cons of chaining – compared to closed hashing • Extra space used for pointers • Extra time required to allocate list nodes dynamically!!! • Worse locality of reference. Significant if lists get long. Size (and number) of data records must be considered. Java Software Structures, 4th Edition, Lewis/Chase

  7. Chaining using an overflow area Chaining (with simulated links) can be accomplished using an array based structure with an overflow area. Pros and cons?? Java Software Structures, 4th Edition, Lewis/Chase

More Related