Problem Time Complexity Space Complexity
Sort the bitonic
O(n) DLL O(1)
Segregate even
O(n) & odd O(1)
nodes in a LL
Merge sort O(n
for DLL
log n) O(log n)
Minimum Stack
O(1) O(n)
The Celebrity
O(n)problem O(1)
Iterative Tower
O(2^n) of Hanoi
O(n)
Stock Span O(n)
problem O(n)
Priority Queue
O(n)using DLL O(1)
Sort withoutO(nextra
log Space
n) O(1)
Max SlidingO(n)
Window O(k)
Stack permutations
O(n^2) O(n)
Recover theO(n)BST O(h)
Views of tree
O(n) O(n)
Assessment- 1 -
Vertical order
O(n) traversalO(n)
Boundary traversal
O(n) O(h)
BFS, DFS O(V + E) O(V)
Dial's Algorithm
O(V + E) O(V + W)
Bellman-FordO(VE)
Algorithm O(V)
TopologicalO(V
Sort+ E) O(V)
Heap Sort O(n log n) O(1)
Binomial heap
O(log n) O(log n)
K-ary heap O(log_k n) O(1)
Winner treeO(n) O(n)
HashMap toO(n TreeMap
log n) O(n)
Types of Sets
- -
Assessment- 2 -
DistributingO(n)
items when O(n)
a person cannot take more than two items of same type
IntroductionO(n)
- Basic fibonacci
O(n) problem
Longest Common
O(mn) Subsequence
O(mn)
Longest Increasing
O(n log n)Subsequence
O(n)
Longest Bitonic
O(n^2) Subsequence
O(n)
Longest Palindromic
O(n^2) Subsequence
O(n^2)
Subset sumO(n*sum)
problem O(n*sum)
0-1 KnapsackO(n*W) O(n*W)
Traveling Salesman
O(n^2 * 2^n) O(n * 2^n)
Coin Change O(n*sum) O(sum)
Shortest Common
O(mn) Supersequence
O(mn)
LevenshteinO(mn)
Distance problem
O(mn)
Rod CuttingO(n^2)
problem O(n)
Wildcard pattern
O(mn)matching O(mn)
Pots of goldO(n^2)
game O(n^2)
OS DBMS RDMBS
- -