Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hash Maps/Hash Tables

Hash Maps/Hash Tables

Did you know that hash maps, also known as hash tables, are among the most popular and highly valued data structures? While they rely on underlying arrays, they offer a more efficient key-value pair storage system compared to arrays alone. In this presentation, we'll explore the inner workings of hash maps, their advantages over arrays, differences between the two, real-life examples of their usage, and how to handle hash collisions. We'll also provide a simple JavaScript coding challenge that demonstrates the practical application of hash maps.

Cindy Kandie

July 18, 2023
Tweet

More Decks by Cindy Kandie

Other Decks in Programming

Transcript

  1. Introduction • Hash maps are highly valued data structures •

    They offer efficient key-value pair storage system • Hash maps are superior to arrays alone • Exploring the inner workings of hash maps • Differences between hash maps and arrays • Real-life examples of hash map usage • Handling hash collisions Photo by Pexels
  2. Advantages of Hash Maps • Efficient key-value storage with O(1)

    time complexity • Abstraction of underlying operations, reducing complexity • Simplicity in handling data retrieval using keys • Built-in support in JavaScript for ease of use Photo by Pexels
  3. Differences between Arrays and Hash Maps • Data accessing: Sequential

    in arrays, key-based in hash maps • Key types: Integer-only for arrays, no restriction for hash maps • Size flexibility: Fixed size in arrays, dynamic resizing in hash maps • Ordering: Maintained in arrays, not guaranteed in hash maps • Memory usage: Hash maps use more memory due to key storage overhead Photo by Pexels
  4. Behind the Scenes: How Hashing Works • Hashing is a

    fundamental concept behind hash maps • Hash function transforms keys into array indices • Unique index assignment enables efficient data retrieval • Handling hash collisions using separate chaining or open addressing Photo by Pexels
  5. Real-Life Examples of Hash Map Usage • Caching: Hash maps

    used to speed up website visits • Spell Checkers: Hash maps store dictionaries for quick verification • Social Media Platforms: Managing user profiles and notifications Photo by Pexels
  6. Coding Challenge: Practical Application of Hash Maps • Presenting a

    JavaScript coding challenge • Demonstrating the use of hash maps in a practical scenario • Solving a problem using hash maps • Exploring the power and versatility of hash maps • Follow this link for details Photo by Pexels
  7. Summary • Recap of the key points discussed • Highlighting

    the significance of hash maps • Reiterating the advantages and real-life examples Photo by Pexels
  8. Conclusion • Hash maps are powerful data structures • Efficient

    and versatile for various applications • Further exploration and understanding recommended Photo by Pexels
  9. Q&A • Time for questions and answers • Clarifying any

    doubts or queries • Encouraging interactive discussions Photo by Pexels