Data Structures β€” Dictionaries & HashMaps

Interactive tutorial: Dictionaries & HashMaps. English & Hindi supported. Try the examples, listen using TTS, and share.

1. Dictionaries & HashMaps β€” Overview

Dictionaries (Python) and HashMaps (JavaScript/Java) are data structures that store data in key-value pairs. Keys are unique identifiers used to look up values quickly. Common uses include caching, indexing and frequency counting. Learn more here.

HashMap Overview
Hash table / dictionary conceptual layout
    

2. Accessing Values & Adding Keys

Access values using keys and add new key-value pairs. Learn more here.

Access and Add
Access by key and add new key
    

3. Deleting Keys

Remove keys and their values using delete (JS) or del (Python). Learn more here.

Delete key
Removing a key-value pair
    

4. Iterating Keys & Values

Loop through keys and values using for...in (JS) or for key in dict (Python). Learn more here.

Iterate dictionary
Iterating keys and values
    

5. Frequency Counting Example

Dictionaries/hashmaps are ideal for counting occurrences of items in an array/list. Learn more here.

Frequency count
Counting frequencies with a dictionary
    

6. Nested / Advanced Dictionaries

Dictionaries can store nested dictionaries/objects for complex data. Learn more here.

Nested dictionary
Nested dictionary / object structure
    

7. Video Tutorial

Watch the YouTube tutorial video below. You can also add your own YouTube link using the input box.

YouTube Tutorial Video

Share this Tutorial

If you liked this tutorial, share it with friends!