Designing a custom structure means composing existing structures so that each required operation hits its target complexity, letting one structure cover another's weakness. The classic technique is pairing a hash map with an array, heap, or linked list.
A worked example: insert, delete, getRandom — all O(1)
Requirements: , , and each in O(1). A hash map alone can't do O(1) random; an array alone can't do O(1) remove. .
