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.

  1. Array
    1. presume or prefix sum technique, this sounds easy but hard to think during the contest.
  2. Sorting
    1. 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.
    2. pair, tuple sorting techniques you should know - Python program to sort a list of tuples by the second Item - GeeksforGeeks
    3. Searching
      1. 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.
      2. Ternary Search - Ternary Search - GeeksforGeeks
    4. Two pointers
      1. Two pointers are a very easy way to solve sorting related problems - Two Pointers Technique - GeeksforGeeks
    5. Graph Algorithms [HackerEarth has good tutorials]
      1. BFS - Breadth-first search - Breadth-First Search Tutorials & Notes | Algorithms | HackerEarth
      2. DFS - Depth-first search - Depth First Search Tutorials & Notes | Algorithms | HackerEarth
      3. Disjoint set(Union find) - Disjoint Set Data Structures - GeeksforGeeks
      4. Prim’s and Kruskal's algorithm for minimum spanning trees - Minimum Spanning Tree Tutorials & Notes | Algorithms | HackerEarth
      5. Dijkstra’s shortest path algorithm - Shortest Path Algorithms Tutorials & Notes | Algorithms | HackerEarth
      6. Flood-fill - these are very important matrix graph problems - Flood-fill Algorithm Tutorials & Notes | Algorithms | HackerEarth
      7. Connected Components - https://www.hackerearth.com/practice/algorithms/graphs/biconnected-components/tutorial/
      8. Strongly connected Components - very important and very tricky to think. - Strongly Connected Components Tutorials & Notes | Algorithms | HackerEarth
      9. Topological sort - very important Topological Sort Tutorials & Notes | Algorithms | HackerEarth
      10. Min cost max flow - Minimum Cost Maximum Flow Tutorials & Notes | Algorithms | HackerEarth
      11. Tree
        1. Pre-order, post-order, in-order traversal - Tree Traversals (Inorder, Preorder and Postorder) - GeeksforGeeks
        2. Find LCA(Lowest common ancestor) - Lowest Common Ancestor in a Binary Tree | Set 1 - GeeksforGeeks
        3. Greedy Algorithm
          1. Greedy algorithm - Wikipedia
        4. String
          1. Z-Algo - Z Algorithm Tutorials & Notes | Algorithms | HackerEarth
          2. Machar's Algo - Manachar’s Algorithm Tutorials & Notes | Algorithms | HackerEarth
        5. Math
          1. Factorization of number - Prime Factorization using Sieve O(log n) for multiple queries - GeeksforGeeks
          2. Prime Numbers in the range - Sieve of Eratosthenes - GeeksforGeeks
          3. GCD/LCM - Program to find LCM of two numbers - GeeksforGeeks
          4. Fast Modular Exponentiation - Modular Exponentiation (Power in Modular Arithmetic) - GeeksforGeeks
          5. Bit Manipulation
            1. Bit masking technique - Solve this problem and learn
          6. Dynamic Programming
            1. all classical problems you should - Top 20 Dynamic Programming Interview Questions - GeeksforGeeks
            2. Classify dynamic prog. in 1D dp array, 2D dp array, 3D or more dp array. Practice accordingly.
            Important data structures,
          7. Linked list
          8. Stack & Queue
          9. Trees (Binary tree, Heap, Binary search tree, Trie, Segment Tree, Red-Black tree)
          10. Graphs (connected, fully connected, bi-partite)
          11. Hash Tables
          12. 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

      Popular posts from this blog

      What is the BEST way to Practice "Cracking the CODING Interview Problems?

      Basic HTTP Server Using NodeJS From Scratch

      Which laptop Should you Buy for Intense Programming(i.e.to develop advanced projects)