#dictionaries
Dictionaries
Dictionaries are Python’s built-in hash map — they store key-value pairs and give you O(1) lookups by key. If lists are for ordered sequences, dictionaries are for labeled data: user profiles, configuration, API responses, anything where you access values by name rather than position. Creating Dictionaries # Empty dict empty = {} # Dict with values user = { "name": "Alice", "email": "alice@example.com", "age": 28, "active": True } # From a list of tuples pairs = [("a", 1), ("b", 2), ("c", 3)] d = dict(pairs) # {'a': 1, 'b': 2, 'c': 3} # From keyword arguments config = dict(host="localhost", port=5432, debug=True) Accessing Values user = {"name": "Alice", "email": "alice@example. Read more →
May 18, 2026
Hash Tables
Introduction Hash tables (also called hash maps or dictionaries) are one of the most important data structures you will use as a developer. They provide near constant-time lookups, inserts, and deletes on average, making them a go-to choice for many real-world problems. By the end of this tutorial, you’ll understand how hash tables work, what a hash function is, how collisions are handled, and when to prefer a hash table over other structures like arrays or linked lists. Read more →
November 18, 2025