Pick a structure0/59 done

Pick a structure from what you need

I needUseCost
Look up by key, count, dedupeMap / SetO(1)
Items in arrival orderQueueO(1)
Most recent first, undo, matchingStackO(1)
Smallest or largest, repeatedlyHeapO(log n)
Sorted data that changes, rangesBalanced BST / B+treeO(log n)
Prefix lookupsTrieO(word length)
Find in sorted array, minimum that worksBinary searchO(log n)
Fewest hopsBFSO(V + E)
Cheapest weighted pathDijkstraO((V + E) log V)
Order with dependenciesTopological sortO(V + E)
Merge groups, are they connectedUnion-findabout O(1)
All combinationsBacktrackingexponential
Best answer from overlapping subproblemsDPstates × work
O(1) lookup plus O(1) orderingMap + doubly linked list (LRU)O(1)