Course · 28 lessons

Algorithms with C#

Practice searching, collection choices, traversal, and small testable algorithms.

  1. Linear search

    Search an unsorted collection with an explicit missing result.

    Core ideas · 10 min
  2. Binary search

    Exploit a sorted input while preserving an index boundary.

    Core ideas · 10 min
  3. Frequency maps

    Count repeated keys in one pass.

    Core ideas · 10 min
  4. Sets and uniqueness

    Track whether a value has already appeared.

    Core ideas · 10 min
  5. Stacks and nesting

    Use last-in-first-out order to match nested delimiters.

    Working with data · 10 min
  6. Queues and arrival order

    Process work in first-in-first-out order.

    Working with data · 10 min
  7. Breadth-first traversal

    Visit a graph by distance using a queue and a visited set.

    Working with data · 10 min
  8. Insertion sort

    Maintain a sorted prefix as each value is inserted.

    Working with data · 10 min
  9. Two-pointer pair search

    Move inward on a sorted array to find a target sum.

    Putting it together · 10 min
  10. Prefix sums

    Precompute cumulative totals for repeated range queries.

    Putting it together · 10 min
  11. Run-length encoding

    Accumulate adjacent equal values while preserving order.

    Putting it together · 10 min
  12. Algorithm contracts and checks

    Verify edge cases using observable inputs and results.

    Putting it together · 10 min
  13. Fixed-size sliding windows

    Update a neighboring window by removing one value and adding one value.

    Deeper practice · 18 min
  14. Compacting a sorted array with two pointers

    Return the meaningful prefix length after removing adjacent duplicates in place.

    Deeper practice · 18 min
  15. Merging two sorted sequences

    Advance the source whose next value is smaller and preserve every remainder.

    Deeper practice · 18 min
  16. Lower bound as a half-open binary search

    Find the first position whose value is not less than a target.

    Deeper practice · 18 min
  17. Merging overlapping intervals

    Choose an endpoint policy and fold intervals in start order.

    Deeper practice · 18 min
  18. Depth-first traversal with an explicit stack

    Control exploration order and prevent cycles from revisiting nodes.

    Deeper practice · 18 min
  19. Topological order and cycle detection

    Schedule directed dependencies only after all their prerequisites are satisfied.

    Deeper practice · 18 min
  20. Dijkstra with stale priority entries

    Find nonnegative weighted shortest paths while ignoring superseded queue work.

    Deeper practice · 18 min
  21. Disjoint sets with path compression

    Track connected components without repeatedly traversing the whole graph.

    Applied techniques · 18 min
  22. Memoization and distinct subproblems

    Cache recursive results while measuring the work actually avoided.

    Applied techniques · 18 min
  23. Dynamic programming for minimum coin count

    Build optimal smaller answers before solving the requested total.

    Applied techniques · 18 min
  24. Greedy interval scheduling by finish time

    Maximize the number of compatible intervals under a precise adjacency rule.

    Applied techniques · 18 min
  25. Keeping the largest k values with a min-heap

    Discard the smallest retained candidate as each new value arrives.

    Applied techniques · 18 min
  26. Next greater values with a monotonic stack

    Resolve pending positions when a new value exceeds them.

    Applied techniques · 18 min
  27. Backtracking permutations and restoring state

    Explore choices recursively while undoing each temporary decision.

    Applied techniques · 18 min
  28. Flood fill with boundary and revisit rules

    Mark cells when queued to visit a connected region exactly once.

    Applied techniques · 18 min