Prepping for your coding interview? Want to learn data structures & algorithms but don't know where to start?
Well you have come to the right place. Data structures & algorithms are of key importance for anyone dealing with programming. Be a software engineer, a computer science student, or a fun enthusiast, having a firm grasp on various topics is crucial. This repository aims to provide implementations of many different data structures & algorithms from basic to some advanced topics. Learn and have a firm grasp on data structures & algorithms to ace your coding interviews and land that dream job!
- Selection Sort - O(n²)
- Bubble Sort - O(n²)
- Insertion Sort - O(n²)
- Merge Sort - O(n log n)
- Quick Sort - O(n²)
- Counting Sort - O(n + k)
- Linear Search - O(n)
- Binary Search - O(log n)
- Find Peak 1D - O(log n)
- Find Peak 2D - O(n)
- Generating Subsets - O(n • 2ⁿ)
- Generating Permutations (Backtracking) - O(n * n!)
- Generating Permutations (Lexicographic) - O(n * n!)
- Least Recently Used Cache
- Least Frequently Used Cache
- Running Median
- Trie
- Fenwick Tree
- Union-Find
- Prefix Sum - O(n)
- Prefix Sum 2D - O(n • m)
- Knuth–Morris–Pratt Algorithm - O(m + n)
- Kruskal's Minimum Spanning Tree - O(E • log E)
- Prim's Minimum Spanning Tree - O(E • log E)
- Maximum Subarray - O(n)
- Coin Change - O(n • c)
- Edit Distance - O(m • n)
- Longest Common Subsequence - O(m • n)
- Longest Increasing Subsequence - O(n • log n)
- nCr mod m - O(n • r)
- Coin Change - O(c)
- Lowest Set Bit - O(1)
- Highest Set Bit - O(1)
- Count Set Bits - O(1)
- Reverse Bits - O(1)
- Primality Test - O(√n)
- Prime Factorization - O(√n)
- Fast Exponentiation - O(log n)
- Fast Modular Exponentiation - O(log n)
- Greatest Common Divisor - O(log(a + b))
- Least Common Multiple - O(log(a + b))
- nCr mod p - O(n)
- Extended Euclidean Algorithm - O(log(a + b))
- Modular Multiplicative Inverse - O(log m)
- Boyer–Moore Majority Vote - O(n • k)