Algoritms are a set of well-defined instructions to solve a specific problem or perform a computation. Sorting and searching are core aspects and are key types of algorithms. The study of DSA involves a comprehensive understanding of various ways to manage data and process it efficiently using different algorithmic techniques. this is the foundation of: 🚀 Performance 📈 Scalability 😊 User experience 💰 Cost optimization 🏗️ Reliable large-scale systems
The field also covers:
  • Recursion and Backtracking
  • Graph Algorithms (e.g. Dijkstra's, Prim's, Kruskal's, maximum flow)
  • Dynamic Programming (solving complex problems by breaking them into subproblems)
  • Greedy Algorithms (making the locally optimal choice at each stage)
  • Bit Manipulation
  • String pattern matching
AreaUse CaseAlgorithms Used
Product Engineering / Industry Examples ScenarioE-commerce product searchFast filtering + sorting (Binary Search, Trees)
Product Engineering / Industry Examples ScenarioFraud detection in financeGraphs, Dynamic Programming
Product Engineering / Industry Examples ScenarioVideo streaming (Netflix)Caching + Efficient Data Transfer
Product Engineering / Industry Examples ScenarioRide-hailing apps (Uber/Ola)Shortest Path Graphs, Heaps
AI / Machine Learning UseFeature selectionDynamic Programming
AI / Machine Learning UseRecommendation systemsGraph algorithms
AI / Machine Learning UseClustering & searchTrees (KD-Trees), Hashing
Internet & System-Level Use System ComponentNetwork routingGraphs
Internet & System-Level Use System ComponentCache memory (fast retrieval)Hash Maps, Queues (LRU)
Internet & System-Level Use System ComponentOperating systems CPU schedulingQueues, Heaps
Internet & System-Level Use System ComponentData compression (ZIP, media)Huffman Trees
Internet & System-Level Use System ComponentLoad balancersHashing + Queues
Everyday Applications Use CaseContacts search in phoneHash Tables, Trees
Everyday Applications Use CaseGPS shortest route (Google Maps)Graph Algorithms (Dijkstra)
Everyday Applications Use CaseAutocomplete & SpellcheckTries, Hash Maps
Everyday Applications Use CaseSocial media feed rankingHeaps, Graphs, Dynamic Programming
NameTime ComplexitySpace ComplexityStablility
Best CaseAverage CaseWorst CasesWorst Case
Bubble SortO(N)O(N^2)O(N^2)O(1)Stable
Selection SortO(N^2)O(N^2)O(N^2)O(1)Unstable
Insertion SortO(N)O(N^2)O(N^2)O(1)Stable
Quick SortO(N log N)O(N log N)O(N^2)O(N)Unstable
Merge SortO(N log N)O(N log N)O(N log N)O(N)Stable
Heap SortO(N log N)O(N log N)O(N log N)O(1)Unstable
NamePrerequisiteTime ComplexitySpace ComplexityStablility
Best CaseAverage CaseWorst CasesWorst Case
LinearO(1)O(N)O(N)O(1)Not applicable as it doesn't reorder elements based on equal values.
BinaryRequires a sorted array.O(1)O(log N)O(log N)O(1) - Iterative, O(log N) - RecursiveNot applicable
BFSO(V+E)O(V+E)O(V+E)O(V)Not Stable
DFSO(V+E)O(V+E)O(V+E)O(H)Stable for finding connected components
JumpO(√N)O(√N)O(√N)O(1)Not applicable
InterpolationRequires a sorted array with uniformly distributed elements.O(log log N)O(N)O(1)Not applicable
NotationsO(1) - Constant Time and Space: The time and space taken is independent of the input size (e.g., accessing an element in an array by its index).O(N) - Linear Time and Space: The time and space taken grows proportionally to the input size (e.g., iterating through an array).O(log N) - Logarithmic Time: The time taken increases slowly as the input size grows (e.g., binary search).O(N log N) - Log-linear Time: The time taken grows slightly faster than linear (e.g., efficient sorting algorithms like Merge Sort).O(N^2) - Quadratic Time: The time taken grows proportionally to the square of the input size (e.g., nested loops).O(2^N) - Exponential Time: The time taken grows very rapidly with the input size, making it impractical for large inputs.O(V+E): The time complexity required to visit every vertex (V) and traverse every edge (E) in the graph exactly onceO(V): The time or space complexity is directly proportional to the number of vertices (nodes)O(H): The space taken grows proportionally to the height of the search tree or graph