Hub for #data-structures-and-algorithms

!scratch/leetcode/leetcode.md

Arrays and Hashing

All 3 results
NameBriefUpdatedTags
CountersCounting contents of an arraynote, data-structures, arrays-and-hashing
Map LookupsUsing a map to find an item in an arraynote, data-structures, arrays-and-hashing
Prefix PostfixTrick to track partial Summation answersnote, data-structures, arrays-and-hashing

Stack

All 2 results
NameBriefUpdatedTags
LIFO Stacklast in first outnote, data-structures, stack
Monotonic StackAlways increasing/decreasing stacknote, stack, data-structures

Two Pointer

All 1 results
NameBriefUpdatedTags
Two Pointer ConvergingFor when you are looking for a pair/targetnote, data-structures, two-pointer
All 4 results
NameBriefUpdatedTags
Binary Search ExactFinding value in sorted arraynote, data-structures, binary-search
Bisect Left-RightFind leftmost or rightmost value in rangenote, binary-search, data-structures
Bisect RangeFind the range of valuesnote, binary-search, data-structures
Predicate SearchTODOnote, binary-search

Sliding Window

All 2 results
NameBriefUpdatedTags
Fixed Sliding WindowFor fixed size problemsnote, data-structures, sliding-window
Variable Sliding WindowFor finding a range that fulfills a conditionnote, sliding-window

Trees

All 7 results
NameBriefUpdatedTags
BacktrackingChoose, explore, undo — DFS over partial solutions with pruningnote, data-structures, trees
Binary Search Tree (BST) Bisect Left-RightClosest value (floor/ceiling) in a BST by walking the treenote, trees, data-structures
Binary Search Tree (BST) Search ExactTree where left <= node <= rightnote, data-structures, trees
Inorder traversalLeft → node → right;note, data-structures, trees
Postorder traversalLeft → right → node;note, data-structures, trees
Preorder traversalNode → left → right;note, data-structures, trees
TrieStructure for text lookupnote, trees, data-structures

Linked List

All 3 results
NameBriefUpdatedTags
Floyd's Cycle DetectionFor finding cycles and their start.note, linked-list, data-structures
Gap MethodSliding window for linked listsnote, data-structures, linked-list
Reverse Linked ListTo reverse a node next node stringnote, data-structures, linked-list

Heap

All 2 results
NameBriefUpdatedTags
HeapMin/max always on topnote, heap, data-structures
Two heapFor keeping a running mediannote, heap, data-structures

Graph

All 4 results
NameBriefUpdatedTags
Adjacency ListGraph+Map+Neighborsnote, graphs, data-structures
Breadth First SearchChecks each level before the nextnote, data-structures, graphs
Depth First SearchPath traversalnote, graphs, data-structures
Dijkstra's AlgorithmShortest distance algonote, data-structures, graphs

Dynamic Programming

All 2 results
NameBriefUpdatedTags
Bottom up DPTable based DPnote, data-structures, dp
Top down DPRecursion based DPnote, data-structures, dp

Greedy

All 1 results
NameBriefUpdatedTags
Kadane's AlgorithmMax-sum contiguous subarray in O(n)note, greedy, data-structures

Math

All 3 results
NameBriefUpdatedTags
Index digit in numberGet the i-th digit of an int without stringsnote, data-structures, math
Integer lengthCount digits of an int without stringsnote, data-structures, math
K Nearest NeighborsNearest in XY plotnote, machine-learning, math, data-structures

State Machine

All 1 results
NameBriefUpdatedTags
State MachineFSMnote, state-machine, data-structures

Sort

All 1 results
NameBriefUpdatedTags
Quick Sortnote, data-structures, data-structures-and-algorithms, sort

Resources