Following are the codes of all the data-structures and algorithms I have learned till now. I implemented all of them in C++. I will also try to add all the resources I have learnt from. I used to practice competitive programming on all the popular websites and I tried to maintain all the codes to a repo. You can find it here. Thank you. Enjoy.
| Algorithm | Code |
|---|---|
| Linear Search | C++ |
| Binary Search | C++ |
| Algorithm | Code |
|---|---|
| Selection Sort | C++ |
| Bubble Sort | C++ |
| Insertion Sort | C++ |
| Merge Sort | C++ |
| Quick Sort | C++ |
| Problem | Code |
|---|---|
| Kadane's Algorithm | C++ |
| Longest Increasing Subsequence | C++ |
| Longest Common Subsequence | C++ |
| Edit Distance | C++ |
| Subset Sum Problem | C++ |
| Minimum No of Coins | C++ |
| Maximum sum Problem | C++ |
| Egg Dropping Puzzle | C++ |
| Form a palindrome | C++ |
| Problem | Code |
|---|---|
| Sparse Table | C++ |
| Segment Tree | C++ |
| Binary Indexed Tree (Fenwick) | C++ |
| Problem | Code |
|---|---|
| Heap / Priority Queue | C++ # |
| Disjoint Set Union (Union Find) | C++ |
| Segment Tree | C++ |
| Binary Indexed Tree (Fenwick) | C++ |
| Trie | C++ # |
| Suffix Tree | C++ # |
| Suffix Array | C++ # |
| Sparse Table | C++ |
| Problem | Code |
|---|---|
| Breadth First Search | C++ |
| Depth First Search Iterative | C++ |
| Depth First Search Recursive | C++ |
| Topological Sort | C++ |
| Problem | Code |
|---|---|
| Cycle Detection Undirected Graph (DFS) | C++ |
| Cycle Detection Undirected Graph (DSU) | C++ |
| Cycle Detection Directed Graph (DFS) | C++ |
| Problem | Code |
|---|---|
| Prim's Algorithm | C++ |
| Kruskal | C++ # |
| Kruskal with Disjoint Set | C++ |
| Problem | Code |
|---|---|
| Shortest path using BFS | C++ |
| Dijkstra’s SSSP | C++ |
| Bellman–Ford | C++ # |
| Problem | Code |
|---|---|
| Floyd-Warshall | C++ |
| Problem | Code |
|---|---|
| Articulation Point (Tarjan) | C++ |
| Strongly Connected Components (Kosaraju) | C++ |
| Problem | Code |
|---|---|
| Inorder Recursive Traversal | C++ |
| Inorder Iterative Traversal | C++ |
| Preorder Traversal | C++ |
| Postorder Traversal | C++ |
| Problem | Code |
|---|---|
| LCA (Binary Tree) | C++ |
| LCA (Euler tour + SegTree) | C++ |
| LCA (Binary Lifting) | C++ |
| Problem | Code |
|---|---|
| KMP Algorithm | C++ # |
| Z Algorithm | C++ # |