🧠 Data Structures & Algorithms
14 Java concepts, each explained step by step with real code, a common trap and practice questions.
- Big-O notationO(1), O(log n), O(n), O(n log n), O(n²); time vs space.
- Linear vs binary searchBinary search needs sorted data; off-by-one and overflow in (lo+hi)/2.
- Simple sortsBubble, selection, insertion sort and when insertion sort wins.
- Merge sort & quicksortDivide and conquer, stability, worst cases.
- How Java sortsDual-pivot quicksort for primitives, TimSort (stable) for objects.
- Stacks & queues in practiceBalanced brackets, BFS, undo — using ArrayDeque.
- Linked listsNodes and pointers, reversal, cycle detection.
- Hash tablesHashing, collisions, load factor — the theory behind HashMap.
- Trees & BSTsTraversals (in/pre/post/level order), balanced trees, TreeMap as a red-black tree.
- HeapsBinary heap operations and top-K problems with PriorityQueue.
- GraphsAdjacency lists, BFS, DFS, shortest paths (Dijkstra) at a conceptual level.
- Recursion & backtrackingSubsets, permutations, pruning.
- Dynamic programmingOverlapping subproblems, memoization vs tabulation.
- Common techniquesTwo pointers, sliding window, prefix sums, greedy.