Top Algorithms to practice for the Interviews:

1. Search Algorithms

⬩Binary Search

2. Sorting Algorithms

⬩Quick Sort, Merge Sort, Heap Sort

3. Array Manipulation

⬩Two-pointer technique

⬩Sliding window (fixed and variable size)

⬩Maximum Subarray Sum (Kadane’s Algorithm)

⬩Dutch national flag algorithm (three-way partitioning)

4. Linked Lists

⬩Reversing a linked list

⬩Detecting cycles

⬩Merging sorted lists

⬩Removing nth node from end

5. Trees

⬩Binary Tree Traversals: Preorder, Inorder, Postorder ⬩Binary Search Tree (BST)

Insertion, deletion, finding minimum/maximum

⬩Lowest Common Ancestor (for binary trees and binary search trees)

⬩Balanced Trees

6. Heaps and Priority Queues

⬩Implementing Min-Heap and Max-Heap

⬩Priority Queue operations and custom comparators

⬩Top K Elements: Finding the top k frequent or smallest/largest elements using heaps

⬩Median in a (dynamically changing) stream (using two heaps)

7. Graph Algorithms

⬩Graph Representation: Adjacency List and Matrix

⬩DFS and BFS for traversal

⬩Topological Sorting (using DFS or Kahn’s Algorithm)

⬩Shortest Path Algorithms: Dijkstra’s, Bellman-Ford, Floyd-Warshall

⬩Minimum Spanning Tree: Kruskal’s and Prim’s

⬩Union-Find (Disjoint Set): Path compression and union by rank

8. Dynamic Programming (DP)

⬩Fibonacci

⬩Longest Common Subsequence (LCS)

⬩Matrix Chain Multiplication (MCM)

⬩Knapsack

9. Greedy Algorithms

⬩Activity Selection

⬩Fractional Knapsack Problem

⬩Job scheduling

⬩Huffman encoding

⬩Interval Problems: Merging intervals, inserting intervals

⬩Minimum Cost to Connect Points

10. String Manipulation

⬩Longest Palindromic Substrings

⬩String matching (Rabin-Karp)

⬩Trie for prefix-based searches and auto-completion

11. Bit Manipulation

⬩Basic Bit Operations: AND, OR, XOR, NOT, left shift, and right shift

⬩Common Bit Tricks: Checking if a number is even/odd, counting set bits (Hamming Weight), finding unique numbers

⬩Power of Two: Checking if a number is a power of two

⬩Swapping Numbers: Using XOR for in-place swapping

⬩Masking and Bit Counting: Using masks for problems like subsets and permutations

Please add the one if you think it's missing here.

Source: x.com/swapnakpanda/status/1856683069740109938

Reply to this note

Please Login to reply.

Discussion

No replies yet.