-
Suffix & Prefix Array, sum or product
- Suffix Arrays with cache
-
sum or product except self
- total = sum(array), for each item, subtract that from total
- total = product(array), for each item, divide that from total
- track division by zero
-
Sliding Window
- if continuous sub-array is asked,
- sliding window does not work with negative no
- Minimum Size Subarray Sum
- Longest Substring Without Repeating Character
- https://leetcode.com/problems/continuous-subarray-sum
-
O(n) important Algorithms
-
Cyclic Sort
-
String Sort
-
Two Pointer
- two pointer with sorted Array
- two pointer with sliding window
- remove duplicate from sorted Array
- Two Pointer to compare two list of intervals
- Matrix Search
- Median of 2 sorted Array
- Search in Rotated Array
- Median of N Sorted Array
- Traversal
- Reverse linked List
- Middle Of linked List
- Traversal in Groups
- Partition Linked List on some Condition
- sort binary linked list
- bucket sort
- Merge two Linked List
- Merge to sorted Linked List
- Cycle
- Detect Cycle
- Find Cycle Point
- Balance Parenthesis
- Tracking Previous Result
- Advance Stack
- Min Stack
- Max Stack
- Infix 2 PostFix
- Expression Evaluation
- K or Kth Largest / Smallest Element
- k largest element
- min and max Heap Combination
- Median of Input Stream
- Caches
- LRU Cache
- LFU Cache
- LRU with Time to Live
- Merge K Sorted List
- Hashing
- Points on a Straight Line
- fraction-to-recurring-decimal
-
Property of tree
-
DFS
- InOrder
- keeping answer in global variable
- traverse 2 trees together
- PreOrder
- PostOrder
- Vertical Order Traversal
- Level Order Traversal
- Diagonal Order Traversal
- InOrder
-
BFS
- Level Order Traversal
- Left and Right Side View of the tree
- Level Zig Zag Traversal
- Level Order Traversal
-
DFS + BFS
- Parent + Children Traversal
-
Generate All Binary Trees
-
DP Solution
- Callan Number
-
Adj List
-
Matrix
-
Cycle Detection
- Directed
- use DFS with global and local visited set,
- Cycle In Directed Graph
- Undirected
- use Union Find // union find only works with undirected
- Cycle In Undirected Graph
- Directed
-
BFS
- Bi-directional BFS
- Normal BFS
- use queue
- Heap BFS
- pick min weight of graph
- Commutable Island
-
DFS
- iterative DFS with stack
- use recursion for normal, use global and local visited set
-
Union Find
- find disconnected graphs
- find parent of each nodes with ranking
-
Minimal Spanning Tree
- do bfs for minimum using heap, instead of queue
-
Topological Sort
- use dfs and the reverse the traversed list
- All topological sorts of a Directed Acyclic Graph
-
In/Out Degree of Graph
- count the incoming connections and outgoing connections in each node
-
Strongly Connected Components
- Kosaraju's Algorithm
- reverse DFS
- Strongly Connected Graphs
- Kosaraju's Algorithm
-
Single Source Shortest Path
- Bellman Fords Algorithm
- Dijsktra Algorithm
-
All Pair Shortest Path
- Floyd-Warshall Algorithm
-
Greedy with single Array Traversal
-
Reverse traversal of Array, with cache
-
use min heap to take greedy decision
-
Find out the item used from the DP problem
-
Constant Space DP
- climbing-stairs
- Selecting Alternating items
-
1D Dp
- Simple Array DP
-
2D Dp
-
Knapsack 0/1
- Subset Sum Problem
- Equal Sum Partition problem
- Target Sum
-
Knapsack Unbounded
- Coin Change Problem
- Rod Cutting Problem
- Maximum Product Cutting
-
Longest Common Subsequence
-
Egg Dropping Problem
-
Matrix Chain Multiplication
-
DP with Grid — Unique Paths
-
DP with Strings
-
DP with bit-masking
ALL DP Questions : DP PROBLEMS
- Fibonacci Heap
- Splay Trees
- Dynamic graph data structures
- Order statistics
- Find i'th smallest element
- Randomized Quick Sort Partitions with Divide & Conquer - O(n)
- Augmented Red Black Trees - O(log n)
- Interval Trees
- find overlapping intervals in O(log n) time.
- augmented red black trees
- Segment Trees
- get SUM, MIN, MAX in O(log n) time