Binary search on answer
Find first true in a sorted condition
Given a monotonic condition over integer values, find the smallest value where the condition becomes true.
Advanced Topics in Computer Science
Students compare algorithms by correctness, runtime, memory, and implementation complexity, with sorting and searching as the main laboratory.
Unit Focus
This unit builds the Big-O vocabulary needed for data structures, competitive programming, and college CS.
Practice Work
Benchmark several search and sort algorithms on random, sorted, and nearly sorted data.
Create an algorithm comparison report with traces and runtime tables.
DSA Assignment Bank
Code Scholars provides structured assignments, implementation support, edge-case review, and runtime analysis coaching so students learn the concept rather than only memorizing a solution.
Binary search on answer
Given a monotonic condition over integer values, find the smallest value where the condition becomes true.
Binary search variants
Given a sorted array with duplicates, return the first and last index of a target without scanning the whole range.
Binary search with cases
Find a target in a rotated sorted array by identifying which half is ordered at each step.
Lower-bound search
Return the index where a target should be inserted to keep a sorted array ordered, including duplicates.
Sort then scan
Sort meeting intervals by start time and merge any intervals that overlap or touch.
Greedy sorting
Choose the largest number of tasks that can fit without overlap by sorting by ending time.
Heap or insertion reasoning
Given logs where each item is at most k positions away from its correct spot, choose and justify an efficient sorting approach.
Selection thinking
Compare sorting the whole array, using a heap, and partition-based selection for finding the kth smallest value.
Sort and scan
Sort values, then scan adjacent pairs to identify duplicates and explain the runtime tradeoff.
Comparator design
Sort records by score descending, then name ascending, then submission time ascending, and explain tie handling.
Two pointers
Given a sorted array, count unique pairs that add to a target while skipping duplicate values correctly.
Two pointers
Given a sorted array, find the pair whose sum is closest to a target and explain how the pointers move.
Binary search invariant
Find the smallest value in a rotated sorted array and state the invariant maintained by the search.
Sorting properties
Given student records with equal grades, explain when preserving original order matters and how to test it.
Counting plus sorting
Count occurrences of values, then sort values by decreasing frequency and increasing numeric value.
Binary search on neighbors
Find an index whose value is not smaller than its neighbors using a logarithmic search strategy.
Runtime analysis
Given code that compares every pair of values, identify the runtime and propose a faster method using sorting or a set.
Empirical analysis
Design an experiment comparing random, sorted, and reverse-sorted input for insertion sort and merge sort.
Binary search by index
Given sorted unique values from a consecutive range with one missing value, find the missing number in logarithmic time.
Binary search feasibility
Given job lengths and worker count, find the smallest maximum workload that allows all jobs to be assigned in order.
Partition reasoning
Explain how sorted order can be used to find a median without merging every value.
Sorted index lookup
For each value in an array, report how many values are smaller using a sorted copy and binary search.
Comparator mapping
Given a custom alphabet order, sort words by mapping each character to its rank.
Single scan
Scan an array to find the longest contiguous increasing run and explain why sorting would change the problem.
Complexity tradeoffs
Given input sizes and time limits, choose between O(n), O(n log n), and O(n squared) approaches and justify the choice.
Trace sorting steps
Given several intermediate arrays, determine which one could occur after a pass of insertion sort or selection sort.
Staircase search
Find a target in a matrix where rows and columns are sorted by starting from a strategic corner.
Binary search over versions
Given versions where all builds after the first failure also fail, find the first failing version with minimum checks.
Preprocessing
Given many lookup queries, decide whether sorting plus binary search or a HashSet gives the better long-term plan.
DSA support
Create a short written analysis comparing two correct solutions by runtime, memory, readability, and input constraints.
Work through the concepts, code, edge cases, and runtime analysis with 1:1 guidance.