whoashish's cp notes

Home

❯

2. Searching and Sorting

2. Searching and Sorting

Oct 08, 20261 min read

  • i. Binary Search: Binary search finds the boundary of a monotone predicate in O(log(range)) evaluations.
  • ii. Ternary and Golden-Section Search: These find the extremum of a unimodal function (strictly increasing then strictly decreasing, or the reverse) with O(log) evaluations.
  • iii. Sorting, Selection and Inversions: In contests you almost never write a sort.

3 items under this folder.

  • Oct 08, 2026

    i. Binary Search

    • searching
    • binary-search
  • Oct 08, 2026

    ii. Ternary and Golden-Section Search

    • searching
    • optimization
  • Oct 08, 2026

    iii. Sorting, Selection and Inversions

    • sorting
    • selection