Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
90 views2 pages

DSA Quick Revision

The document provides a quick revision of Data Structures and Algorithms (DSA) covering key concepts such as Big-O complexities, array and string operations, recursion, linked lists, stacks, queues, trees, graphs, dynamic programming, greedy algorithms, and miscellaneous mathematical techniques. It includes specific algorithms and their complexities, such as binary search, sorting methods, and cycle detection in linked lists. The notes serve as a concise reference for common DSA topics and techniques.

Uploaded by

ashishky5093
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)
90 views2 pages

DSA Quick Revision

The document provides a quick revision of Data Structures and Algorithms (DSA) covering key concepts such as Big-O complexities, array and string operations, recursion, linked lists, stacks, queues, trees, graphs, dynamic programming, greedy algorithms, and miscellaneous mathematical techniques. It includes specific algorithms and their complexities, such as binary search, sorting methods, and cycle detection in linked lists. The notes serve as a concise reference for common DSA topics and techniques.

Uploaded by

ashishky5093
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/ 2

DSA Quick Revision Notes

1. Basics & Complexity

Big-O complexities (common): O(1) < O(log n) < O(n) < O(n log n) < O(n^2) < O(2^n) < O(n!).
Array Access: O(1), Search: O(n) or O(log n) if sorted, Insert/Delete: O(n).

2. Arrays & Strings

Binary Search: O(log n).


Sliding Window: used for subarray problems (max sum, distinct chars).
Sorting: QuickSort Avg O(n log n), Worst O(n^2); MergeSort O(n log n).

3. Recursion & Backtracking

Factorial, Fibonacci recursion basics.


Backtracking: generate subsets, permutations, N-Queens.

4. Linked List

Reverse a Linked List: Iterative & Recursive O(n).


Cycle Detection: Floyd’s Cycle Algorithm (Tortoise & Hare).
Merge two sorted lists: O(n+m).

5. Stacks & Queues

Stack apps: Balanced Parentheses, Next Greater Element.


Queue apps: BFS traversal.
Deque: for sliding window maximum.

6. Trees

Traversals: Inorder, Preorder, Postorder, Level Order (BFS).


BST: Inorder traversal gives sorted order.
Lowest Common Ancestor (LCA) in O(h).

7. Graphs

Graph Traversals: BFS (queue), DFS (stack/recursion).


Dijkstra’s Algorithm: shortest path in weighted graph.
Union Find (Disjoint Set): cycle detection in O(alpha(n)).
8. Dynamic Programming

Classic DP: Fibonacci, Knapsack, LIS, Matrix Min Path.


DP State Design → define dp[i] clearly.
Memoization (Top-Down) vs Tabulation (Bottom-Up).

9. Greedy

Activity Selection Problem → earliest finishing first.


Huffman Coding for data compression.

10. Misc (Math & Bits)

GCD → Euclidean Algorithm O(log n).


Fast Power (Binary Exponentiation).
Bit Tricks: check odd/even (n & 1), swap (XOR), subsets (1<<n).

You might also like