Design a HashMap from Scratch (Array + Linked List Buckets)
Requirements: Implement a HashMap data structure from scratch, supporting put/get/remove, using an array of buckets where each bucket handles collisions via chaining (linked list or vector).
Design: Maintain an array of N buckets; a hash function maps each key to a bucket index (hash(key) % N). Each bucket is a linked list (or dynamic array) of key-value pairs; on collision, entries are appended to the same bucket's list, and lookups within a bucket do a linear scan. Discuss load factor and dynamic resizing (rehashing all entries into a larger array once load factor exceeds a threshold) to keep average-case O(1) operations. Contrast with an ordered map (backed by a balanced BST/tree, giving sorted key iteration and O(log n) operations) versus this unordered, hash-based approach (average O(1), no ordering guarantee).