Kth Smallest Subarray Sum
Find the k-th smallest sum among all contiguous subarrays, usually for nonnegative arrays.
38 notes
Find the k-th smallest sum among all contiguous subarrays, usually for nonnegative arrays.
Find the k-th smallest absolute difference among all pairs in an array.
Select the k-th smallest element from a matrix whose rows and columns are sorted.
Selection and order-statistics: quickselect, median-of-medians, streaming top-k, heavy hitters, reservoir sampling, and quantile summaries.
Select the next smallest element on demand, avoiding full sorting until all elements are requested.
Use a tournament tree to extract the smallest or largest k elements in sorted order without fully sorting the input.
Extract and sort the top k elements (smallest or largest) from a sequence without fully sorting it.
Rearrange a sequence so that the smallest k elements appear in sorted order, without fully sorting the entire sequence.
Sort by repeatedly selecting the minimum element using a tournament tree.
Use sampling to approximate order statistics and refine selection efficiently.
Maintain the k-th largest value while values arrive one at a time.
Select the k-th smallest fraction formed by pairs from a sorted array using heap or binary search.
Select the k-th smallest element from two sorted arrays without merging them.
Select multiple order statistics in one pass more efficiently than repeated selection.
Select the upper median, the element at index floor(n/2), using selection or partitioning.
Select the lower median, the element at index floor((n-1)/2), using selection or partitioning.
Select an element whose total weight on each side is at most half of the total weight.
Compute the sorted-order rank of a key in a search tree augmented with subtree sizes.
Select the element with a given rank from a balanced search tree augmented with subtree sizes.
Select the k-th smallest element in an unsorted array using partitioning.
Find frequent items in a stream using bounded memory.
Maintain the k largest elements while values arrive one at a time.
Select the k smallest elements using bounded structures or partitioning.
Find the k largest elements using partition-based selection in linear time.
Find the k largest or k smallest elements by maintaining a bounded heap.
Rearrange an array so that the element at position k is the same as in sorted order, with partition guarantees.
Select the k-th element by partially sorting only the needed prefix of the array.
Select the k-th smallest or largest element by maintaining a heap of candidate values.
Hybrid selection algorithm that combines Quickselect with worst-case fallback.
Choose a pivot with guaranteed quality by taking the median of group medians.
Selection algorithm with guaranteed linear time using structured pivot choice.
Quickselect with random pivot selection to achieve robust expected linear time.
Find the second largest element in a sequence.
Find the second smallest element in a sequence.
Find the middle value of a collection in linear time using selection algorithms, without the overhead of a full sort.
Find the element at a given rank using quicksort's partition step but recursing into only one side, achieving expected linear time.
Find the largest or smallest k elements without sorting the full input, using a heap or partition-based approach.
Produce only the smallest k elements in sorted order rather than sorting the entire array, reducing unnecessary work when the full order is not needed.