0% found this document useful (0 votes)
5 views29 pages

Graph Graph Graph Graph Graph

The document outlines various algorithms and data structures, including graph algorithms, dynamic programming techniques, and tree operations. It covers topics such as minimum spanning trees, shortest paths, union-find, and various dynamic programming strategies for different problem types. Additionally, it lists specific problems and their corresponding solutions related to these concepts.

Uploaded by

somanip8970
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views29 pages

Graph Graph Graph Graph Graph

The document outlines various algorithms and data structures, including graph algorithms, dynamic programming techniques, and tree operations. It covers topics such as minimum spanning trees, shortest paths, union-find, and various dynamic programming strategies for different problem types. Additionally, it lists specific problems and their corresponding solutions related to these concepts.

Uploaded by

somanip8970
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Graph

Graph
Graph
Graph
Graph

Graph
Graph

Graph
Graph
Graph

Graph
Graph
Graph
Graph
Graph
Graph
Graph

Graph
Graph
Graph
Graph
Graph
Minimum Spanning Tree
Minimum Spanning Tree
Minimum Spanning Tree

Union Find
Union Find
Union Find
Union Find
Union Find

Shortest Path
Shortest Path
Shortest Path
Shortest Path
Shortest Path
Shortest Path
Shortest Path

Topological Sort
Topological Sort
Topological Sort
d
Heap
Heap
Heap
Heap
Heap
Heap
Heap
Heap
Heap

Tree
Detect-cycle-in-a-directed graph
Detect-cycle-in-an-undirected-graph
Possible-bipartition
Is-graph-bipartite
Find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance

Minimum-number-of-vertices-to-reach-all-nodes
Maximal-network-rank

Number-of-closed-islands
Pacific-atlantic-water-flow
Minimum-operations-to-convert-number
Number-of-distinct-islands

Keys-and-rooms
Time-needed-to-inform-all-employees

Reorder-routes-to-make-all-paths-lead-to-the-city-zero
Jump-game-iii
Open-the-lock
Word-ladder

Convert-sorted-list-to-binary-search-tree
mother-vertex
Snakes-and-ladders
Clone-graph
Connecting-cities-with-minimum-cost
Min-cost-to-connect-all-points
Optimize-water-supply-in-a-village

Number-of-operations-to-make-network-connected
Most-stones-removed-with-same-row-or-column
Earliest-moment-when-everyone-become-friends
Number-of-islands-ii
Making-a-large-island

Dijkshtra Algorithm - Print Shortest Path


Network-delay-time
Shortest-path-in-binary-matrix
Path-with-minimum-effort
Cheapest-flights-within-k-stops
Minimum-multiplications-to-reach-end
01-matrix
Accounts-merge
Number-of-ways-to-arrive-at-destination

Course-schedule
Find-eventual-safe-states
Alien-dictionary
Merge-k-sorted-arrays
Merge-k-sorted-lists
Find-median-from-data-stream
Merge-two-binary-max-heap
Is-binary-tree-heap
Convert-bst-min-heap
Convert-min-heap-to-max-heap
Reorganize-string
Mnimum-sum
Maximum-sum-combinations

Convert Binary tree to binary-search-tree


Validate-binary-search-tree
Minimum-swap-required-convert-binary-tree-binary-search-tree
boundary-traversal-of-binary-tree
Floyd Warshall

Boundary DFS
Boundary DFS

DFS
Anytime we need to remove extra or redunant edges we can use union find
If a=b and b=c then if it imples a=c then it means question is only solvable by union find
edunant edges we can use union find
n it means question is only solvable by union find
1D DP
1D DP

DP on Grids
DP on Grids
DP on Grids
DP on Grids

DP on Subsequences
DP on Subsequences
DP on Subsequences
DP on Subsequences
DP on Subsequences

DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on String
DP on Stocks
DP on Stocks
DP on Stocks
DP on Stocks
DP on Stocks
DP on Stocks

DP on LIS
DP on LIS
DP on LIS
DP on LIS
DP on LIS

DP on Matrices
DP on Matrices
DP on Matrices

Partition DP
Partition DP
Partition DP
Partition DP
Partition DP
Partition DP
Partition DP
Partition DP

DP on Trees
DP on Trees
DP on Trees
DP on Trees
Stone Game
Stone Game
Stone Game
Stone Game
Stone Game
Stone Game
Stone Game
Stone Game

Miscellaneous
DYNAMIC PROGRAMMING

Friends-pairing-problem
House-robber-ii

Unique-paths-II
Minimum path sum in Triangle
Maximum-path-sum-in-the-matrix
Paint-house

Subset-sum-equal-to-k
Count of Subsets with given sum
Decode-ways
coin-change
coin-change-2

Longest-common-subsequence
Print Longest Common Subsequence
Longest-common-substring
Shortest-common-supersequence
Longest-palindromic-subsequence
Minimum-insertions-to-make a string-palindrome
Minimum Insertions and deletions-to-convert-one string to another string
Distinct-subsequences
Edit-distance
Repeating-subsequence
Interleaving-string
Best-time-to-buy-and-sell-stock
Best-time-to-buy-and-sell-stock-ii
Best-time-to-buy-and-sell-stock-iii
Best-time-to-buy-and-sell-stock-iv
Best-time-to-buy-and-sell-stock-with-cooldown
Best-time-to-buy-and-sell-stock-with-transaction-fee

Longest-increasing-subsequence
Number-of-longest-increasing-subsequence
Longest Bitonic Subsequence
Longest-string-chain
Largest-divisible-subset

Count-square-submatrices-with-all-ones
Sub-matrices-with-sum-zero
Max-rectangle-in-binary-matrix

Matrix-chain-multiplication
Minimum-cost-to-cut-a-stick
Minimum-cost-to-merge-stones
Burst-balloons
Evaluate-expression-to-true
Super-egg-drop
Palindrome-partitioning-ii
Partition-array-for-maximum-sum
stone-game
stone-game-ii
stone-game-iii
stone-game-iv
stone-game-v
stone-game-vi
stone-game-vii

Is-subsequence
jump-game
Maximum-product-subarray
Recursion TC = O(2^mn) as at every cell we have two choices , SC = O(m+n) bcz it equals p
No need for recursion and memoization dp. Can direct do such problems using tabulation

Recursion TC = O(2^n), SC = O(n) for recursion stack n = size of array ---> Memoization TC
See edge case when array may contains 0 as its element bcz in general we have assumed a

Similar answer for minimum deletions to make string palindrome


Also Print the LIS and do it using binary search

For square submatrices, we'll do this technique.


And for rectangle submatrices we'll convert to 1D problem and then solve it
emoization - TC = O(mn) , SC = O(mn) for 2D dp vector and O(m+n ) for recursion stack. Tabulation -

= O(n*sum) + (n) for reursion stack ---> Tabulation TC = O(n*sum) SC = O(n*sum) ---> Space optimi
t of positive numbers only
n stack. Tabulation - TC = O(mn), SC = O(mn) for dp vector

m) ---> Space optimized TC = O(n*sum) , SC = O(sum) for using prev and curr array of size sum+1
ay of size sum+1
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking
Backtracking

Greedy
Greedy
Greedy
Greedy
Greedy
Greedy
Greedy
Greedy
String
https://leetcode.com/problems/combinations/description/
https://leetcode.com/problems/subsets-ii/description/
https://leetcode.com/problems/permutations-ii/description/
https://www.interviewbit.com/problems/maximal-string/
https://www.interviewbit.com/problems/kth-permutation-sequence/
https://www.interviewbit.com/problems/gray-code/
https://www.interviewbit.com/problems/letter-phone/

Merge-intervals
Insert-interval
Non-overlapping-intervals
Disjoint-intervals
Activity-selection-problem
Meeting-rooms
N-meetings-in-one-room
Gas-station
Minimum-add-to-make-parentheses-valid
Count-and-say
Time and Space Complexity
BST
Tree

Validate-binary-search-tree
Maximum-sum-bst-in-binary-tree
1-Jul
Topological Sort

You might also like