TweakCode
Search lessons

Course 02 · Orientation

Search

Sorted space and lists

How sorting works and what it unlocks, binary search on arrays and on answers, and linked lists you re-point in place.

Start with Sorting

The course journey

Build one family of skills at a time

Each technique is three short lessons, and each one builds on the lesson before it. A lesson walks through one problem step by step, then hands it to you along with a few more to solve on your own.

  1. 01Start here

    Sorting

    Sort once so pair questions need only neighbors, merge sorted runs in one scan, and find one rank without a full sort.

    1. Stage 1Comparison Sorting & Adjacent SweepsOrder elements so global comparisons become adjacent checks1 Lesson · 3 Problems
    2. Stage 2Two-Pointer Merge PassesCombine two sorted runs in a single O(n + m) scan1 Lesson · 3 Problems
    3. Stage 3Quickselect & Order StatisticsPartition around a pivot to find the k-th rank without full sorting1 Lesson · 3 Problems
  2. 02Pro

    Binary Search

    Halve a sorted range, a rotated one, or a range of possible answers.

    1. Stage 1

      Classic Binary Search

    2. Stage 2

      Modified Binary Search

    3. Stage 3

      Binary Search on the Answer

    Preview
  3. 03Pro

    Linked List

    Rewire next links in place: reverse a list, splice behind a dummy head, and pace two pointers to find middles and cycles.

    1. Stage 1

      In-Place Pointer Reversal

    2. Stage 2

      Sentinel (Dummy) Head & Merging

    3. Stage 3

      Fast & Slow Pointers (Floyd's Cycle)

    Preview