0% found this document useful (0 votes)
184 views3 pages

DSA_Cheat_Sheet

The document is a cheat sheet for various data structures and algorithms, organized into categories such as Arrays, Linked Lists, Trees, Graphs, Sorting Algorithms, Searching Algorithms, and Dynamic Programming. Each category lists key algorithms and techniques, including their names and some complexities. This serves as a quick reference guide for understanding and implementing essential algorithms in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views3 pages

DSA_Cheat_Sheet

The document is a cheat sheet for various data structures and algorithms, organized into categories such as Arrays, Linked Lists, Trees, Graphs, Sorting Algorithms, Searching Algorithms, and Dynamic Programming. Each category lists key algorithms and techniques, including their names and some complexities. This serves as a quick reference guide for understanding and implementing essential algorithms in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DSA Algorithm Cheat Sheet

Arrays
- Prefix Sum

- Sliding Window

- Two Pointer Technique

- Kadane's Algorithm (Max Subarray Sum)

- Dutch National Flag (3-way partitioning)

Linked Lists
- Reverse a linked list (iterative & recursive)

- Detect cycle (Floyd's algorithm)

- Merge two sorted lists

- Find middle (Tortoise & Hare)

- Remove N-th node from end

- Intersection of two lists

- Clone list with random pointer

Trees
- DFS / BFS

- Diameter of Tree

- Lowest Common Ancestor (LCA)

- Height / Depth of tree

- Balanced Tree Check

- Tree to DLL conversion

- Serialize/Deserialize Binary Tree

Graphs
- DFS, BFS

- Dijkstra's Algorithm

- Bellman-Ford

- Floyd-Warshall

- Topological Sort (DFS/Kahn's)


- Union-Find (Disjoint Set)

- Kruskal's Algorithm

- Prim's Algorithm

- Tarjan's & Kosaraju's (SCC)

Sorting Algorithms
- Bubble Sort - O(n²)

- Selection Sort - O(n²)

- Insertion Sort - O(n²)

- Merge Sort - O(n log n)

- Quick Sort - O(n log n)

- Heap Sort - O(n log n)

- Counting Sort

- Radix Sort

- Bucket Sort

Searching Algorithms
- Linear Search - O(n)

- Binary Search - O(log n)

- Lower/Upper Bound

- Binary Search on Answer

- Ternary Search

- Hashing - O(1) avg

Dynamic Programming
- Fibonacci

- 0/1 Knapsack

- Unbounded Knapsack

- LCS (Longest Common Subsequence)

- LIS (Longest Increasing Subsequence)

- Matrix Chain Multiplication

- Partition Equal Subset Sum

- Edit Distance

- DP on Trees
- Bitmask DP

You might also like