Skip to content
/ dsa Public

Data Structures and Algorithms for coding interviews

Notifications You must be signed in to change notification settings

0xFonzy/dsa

Repository files navigation

Data Structures and Algorithms

Problem with Coding Interview Prep

Coding interview prep courses and platforms like Leetcode often provide only a limited overview of data structures and algorithm patterns, leaving gaps in knowledge when encountering unfamiliar problems.

They typically cover only a few patterns per data structure and expect developers to identify patterns independently through practice.

Previously, it was challenging to find a comprehensive list of these patterns online.

This repository uses ChatGPT to offer a complete list of essential algorithms for coding interviews.

Comprehensive list of Algorithms per Data Structure

Arrays

  1. Two pointers
  2. Sliding window
  3. Binary search
  4. Prefix sums
  5. Sorting and Greedy Algos
  6. Backtracking
  7. Dynamic Programming on Arrays
  8. Monotonic Stack
  9. Kadane's Algo
  10. Dutch national flag algo
  11. Merge Intervals

Breadth First Search

  1. Level Order Traversal of a Tree
  2. Shortest Path in an Unweighted Graph
  3. Connected Components in a Graph
  4. Find Min Depth of Binary Tree
  5. Word Ladder Problem

Binary Search

  1. Basic Binary Search
  2. Finding the Leftmost (First) Occurence
  3. Finding the Rightmost (Last) Occurence
  4. Finding the Smallest Element Greater than or equal to target
  5. Finding the Largest Element Less than or equal to target
  6. Rotated Sorted Array Search

Binary Tree

  1. Tree Traversals
  2. Level-Order Traversal
  3. Height of a Tree
  4. Checking for a Balanced Tree
  5. Finding a Node
  6. Inserting a Node
  7. Deleting a Node
  8. Lowest Common Ancestor (LCA)

Binary Search Tree

  1. Insertion
  2. Search
  3. Deletion
  4. Traversal
  5. Finding Min and Max

Depth First Search

  1. Graph Traversal with Stack
  2. Graph Traversal Recursive
  3. Tree Traversal Preorder
  4. Tree Traversal Inorder
  5. Tree Traversal Postorder
  6. Graph Cycle Detection
  7. Graph Topological Sort
  8. Graph Find Connected Components

Dynamic Programming

  1. Memoization (Top-Down Approach)
  2. Tabulation (Bottom-Up Approach)
  3. State and Transition
  4. Space Optimization
  5. Combinatorial Problems
  6. Matrix Chain Multiplication

Graphs

  1. BFS
  2. Topological Sort
  3. Union-Find (Disjoint Set)
  4. Shortest Path (Dijkstra Algo)
  5. Shortest Path (Bellman-Ford Algo)
  6. Min Spanning Tree (Kruskal's Algo)
  7. Min Spanning Tree (Prim's Algo)
  8. Special Graphs (Bipartite Graph)

Hash Tables

  1. Counting Frequencies
  2. Two Sum Problem
  3. Group Anagrams
  4. Find Duplicates
  5. Intersection of Two Arrays
  6. Longest Consecutive Sequence
  7. Subarray Sum Equals K
  8. Top K Frequent Elements
  9. Valid Sudoku
  10. Word Pattern

Heaps

  1. Kth largest/smallest element
  2. Merge K Sorted Lists
  3. Top K frequent elements
  4. Find Median Data Stream
  5. Task Scheduler
  6. Reorganize String
  7. Meeting Rooms II
  8. Sort Characters by Frequency

Linked Lists

  1. Two Pointers (Fast and Slow)
  2. Reverse Linked List
  3. Merged Lists
  4. Cycle detection removal
  5. Removing N-th node from end
  6. Finding intersection of two linked lists
  7. Palindrome Check
  8. Flattening Multilevel Doubly Linked List

Merge Sort

  1. Sorting an Array
  2. Count Inversions
  3. Merge K Sorted Arrays
  4. Find Kth Smallest Element
  5. Find Kth Largest Element
  6. Sort Linked List using Merge Sort

Queues

  1. BFS
  2. Sliding Window Max
  3. Rotting Oranges
  4. Implement Queue using Stacks
  5. Circular Queue
  6. Course Schedule (Topological Sort)
  7. Binary Tree Right Side View

Quicksort

  1. In-Place Sorting
  2. Custom Comparator
  3. Edge Cases
  4. Iterative Quicksort

Recrusion

  1. Factorial (Base Case and Recursive Case)
  2. Fibonacci (Tree Recursion)
  3. Tail Recursion (Optimized Factorial)
  4. Backtracking (N-Queens)
  5. Memoization (Optimized Fibonacci)

Stacks

  1. Balanced Parentheses
  2. Next Greater Element
  3. Min Stack
  4. Evaluate Reverse Polish Notation
  5. Daily Temperatures
  6. Simplify Path
  7. Decode String
  8. Largest Rectangle in Histogram

About

Data Structures and Algorithms for coding interviews

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published