What are the popular Algorithms that you need to know as a COMPETITIVE Programmer
I will try to list popular algorithms and some techniques that you should know.
- Array
- presume or prefix sum technique, this sounds easy but hard to think during the contest.
- Sorting
- All sorting algorithms (bubble sort, insertion sort, selection sort, quick sort, merge sort, heap sort, radix sort), there was a question where I had implemented merge sort from scratch for strings sorting. So you need to know how to implement them. Radix sort’s bucketing technique is important.
- pair, tuple sorting techniques you should know - Python program to sort a list of tuples by the second Item - GeeksforGeeks
- Searching
- Binary Search, very important. You can binary search to search an element. binary search to find an answer. Binary Search - InterviewBit here, you can see the section “Search Answer”. Just solve it.
- Ternary Search - Ternary Search - GeeksforGeeks
- Two pointers
- Two pointers are a very easy way to solve sorting related problems - Two Pointers Technique - GeeksforGeeks
- Graph Algorithms [HackerEarth has good tutorials]
- BFS - Breadth-first search - Breadth-First Search Tutorials & Notes | Algorithms | HackerEarth
- DFS - Depth-first search - Depth First Search Tutorials & Notes | Algorithms | HackerEarth
- Disjoint set(Union find) - Disjoint Set Data Structures - GeeksforGeeks
- Prim’s and Kruskal's algorithm for minimum spanning trees - Minimum Spanning Tree Tutorials & Notes | Algorithms | HackerEarth
- Dijkstra’s shortest path algorithm - Shortest Path Algorithms Tutorials & Notes | Algorithms | HackerEarth
- Flood-fill - these are very important matrix graph problems - Flood-fill Algorithm Tutorials & Notes | Algorithms | HackerEarth
- Connected Components - https://www.hackerearth.com/practice/algorithms/graphs/biconnected-components/tutorial/
- Strongly connected Components - very important and very tricky to think. - Strongly Connected Components Tutorials & Notes | Algorithms | HackerEarth
- Topological sort - very important Topological Sort Tutorials & Notes | Algorithms | HackerEarth
- Min cost max flow - Minimum Cost Maximum Flow Tutorials & Notes | Algorithms | HackerEarth
- Tree
- Pre-order, post-order, in-order traversal - Tree Traversals (Inorder, Preorder and Postorder) - GeeksforGeeks
- Find LCA(Lowest common ancestor) - Lowest Common Ancestor in a Binary Tree | Set 1 - GeeksforGeeks
- Greedy Algorithm
- String
- Z-Algo - Z Algorithm Tutorials & Notes | Algorithms | HackerEarth
- Machar's Algo - Manachar’s Algorithm Tutorials & Notes | Algorithms | HackerEarth
- Math
- Factorization of number - Prime Factorization using Sieve O(log n) for multiple queries - GeeksforGeeks
- Prime Numbers in the range - Sieve of Eratosthenes - GeeksforGeeks
- GCD/LCM - Program to find LCM of two numbers - GeeksforGeeks
- Fast Modular Exponentiation - Modular Exponentiation (Power in Modular Arithmetic) - GeeksforGeeks
- Bit Manipulation
- Bit masking technique - Solve this problem and learn
- Dynamic Programming
- all classical problems you should - Top 20 Dynamic Programming Interview Questions - GeeksforGeeks
- Classify dynamic prog. in 1D dp array, 2D dp array, 3D or more dp array. Practice accordingly.
- Linked list
- Stack & Queue
- Trees (Binary tree, Heap, Binary search tree, Trie, Segment Tree, Red-Black tree)
- Graphs (connected, fully connected, bi-partite)
- Hash Tables
Important data structures,
This is all I can think of right now.
Please let me know if I forgot anything. I will add.
Thank You.
(ping me for any help)
Godspeed.
Comments
Post a Comment