← Library08 Sources/Saturngod PDFs

source · pdf · algorithms · data-structures

Algorithms

08 Sources/Saturngod PDFs/Algorithms.md

Algorithms

Official PDF

Actual coverage

Algorithms; Big-O time/space; RAM/arrays; hash tables; two pointers; sliding windows; stacks/queues; linked lists; binary search; recursion; sorting; heaps/priority queues; trees; binary-search trees; tries; backtracking; graphs; BFS/DFS; advanced graph algorithms; greedy methods; intervals; one- and two-dimensional dynamic programming; bit manipulation.

Problem-solving map

  • Two pointers: related positions moving through ordered/structured input.
  • Sliding window: contiguous ranges with incrementally maintainable state.
  • Stack/queue: nesting/history versus arrival order/frontiers.
  • Binary search: monotonic search space, not only arrays.
  • Heap: repeated access to the current minimum/maximum without fully sorting.
  • Tree/trie: hierarchy, ordered lookup, and prefix structure.
  • BFS: shortest paths in unweighted graphs and level order.
  • DFS/backtracking: exhaustive structure with reversible choices and pruning.
  • Greedy: locally optimal irreversible choices; requires a correctness argument.
  • Dynamic programming: overlapping subproblems plus a state/transition definition.

Solving discipline

  1. Define input, output, constraints, and examples.
  2. Write the brute-force solution and complexity.
  3. Identify repeated work, monotonicity, ordering, or the needed access pattern.
  4. Choose the structure/pattern and state its invariant.
  5. Prove termination and correctness informally.
  6. Test empty, minimal, duplicate, ordered, reverse, and maximum cases.

Knowledge connections