TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation · 5.9K subscribers
Post #1313 740
▎ Algorithms - Quick Reference Cheat Sheet

In this post, we’ll cover some fundamental algorithms that every programmer should know.

📌 Sorting Algorithms
Sorting is essential for organizing data. The most common sorting algorithms include:

• Bubble Sort: A simple comparison-based algorithm with a time complexity of O(n²). It repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.

• Selection Sort: This algorithm divides the input list into two parts: a sorted and an unsorted region. It has a time complexity of O(n²) as well, selecting the smallest (or largest) element from the unsorted part and moving it to the sorted part.

• Insertion Sort: Builds the final sorted array one item at a time. It has a time complexity of O(n²) but performs well for small data sets or nearly sorted data.

• Merge Sort: A divide-and-conquer algorithm with a time complexity of O(n log n). It divides the array into halves, sorts them, and merges them back together.

• Quick Sort: Another divide-and-conquer algorithm with an average time complexity of O(n log n). It selects a 'pivot' element and partitions the other elements into two sub-arrays according to whether they are less than or greater than the pivot.


📌 Search Algorithms
Searching is crucial for finding elements in data structures. Key search algorithms include:

• Linear Search: A simple method with a time complexity of O(n) that checks each element in a list until it finds the target value.

• Binary Search: A more efficient search method with a time complexity of O(log n), but it requires the list to be sorted. It repeatedly divides the search interval in half.

Graph Algorithms: Graphs are used to represent networks. Important graph algorithms include:

• Depth-First Search (DFS): Explores as far as possible along each branch before backtracking. It's implemented using recursion or a stack.

• Breadth-First Search (BFS): Explores all neighbors at the present depth prior to moving on to nodes at the next depth level. It's implemented using a queue.

Dynamic Programming: This technique is used to solve problems by breaking them down into simpler subproblems and storing the results to avoid redundant calculations. Common examples include the Fibonacci sequence and the Knapsack problem.

📝 Tips for Interviews:

👉 Understand how different algorithms work and their time/space complexities.
👉 Be prepared to explain your reasoning behind choosing a specific algorithm for a problem.
👉 Practice coding these algorithms from scratch to reinforce your understanding.
  • ❤ 1
  • 👏 1
More from @coding_interview_preparation
  1. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  2. Oct 6, 2026document post
  3. Oct 4, 2026💼 Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  4. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
  5. Oct 1, 2026Most Asked Topics in AI Engineer Interviews Based on 2026 candidate reports
  6. Sep 30, 2026💼 What Companies Actually Look For in a Fresher Think companies only care about your CGPA…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →