Skip to main content

Data Structures & Algorithms

DSA knowledge is tested in coding interviews alongside system design and language depth. Understanding time and space complexity, knowing which data structure to reach for in a given scenario, and being able to implement common algorithms in Java are skills that distinguish candidates at competitive companies.

What You'll Find Here

Notes are being added. Planned topics:

TopicDescription
Complexity AnalysisBig-O notation; time vs. space trade-offs; amortized analysis.
Arrays & StringsTwo-pointer, sliding window, prefix sums — core array techniques.
Linked ListsSingly/doubly linked; fast-slow pointer; reverse; detect cycle.
Stacks & QueuesDeque as stack/queue; monotonic stack pattern.
Trees & BSTBinary tree traversals (DFS/BFS); BST operations; balanced trees.
Heaps & Priority QueueMin-heap, PriorityQueue<> in Java; k-th largest, merge k sorted.
Hash Maps & SetsHash collision; open addressing vs. chaining; frequency counting.
GraphsBFS, DFS, topological sort, Dijkstra, union-find.
Sorting AlgorithmsQuickSort, MergeSort, HeapSort; Arrays.sort (TimSort); stability.
Dynamic ProgrammingMemoization vs. tabulation; classic problems (LCS, 0/1 knapsack, coin change).

Learning Path

  1. Complexity Analysis — you can't discuss solutions without understanding time/space trade-offs.
  2. Arrays & Strings — two-pointer and sliding window patterns cover 30%+ of coding interview problems.
  3. Hash Maps & Sets — constant-time lookup unlocks optimal solutions for frequency and grouping problems.
  4. Trees — BFS/DFS traversal is tested in both tree and graph problems.
  5. Dynamic Programming — the hardest category; start with memoization before tabulation.
  • Collections Framework — Java's ArrayList, HashMap, PriorityQueue, and ArrayDeque implement these data structures.
  • Functional Programming — streams offer declarative alternatives to imperative algorithms.
  • System Design — algorithm choice affects system-level performance and scalability.