Results for “sorted”
Small, practical examples. Search by task or narrow things down below.
Iterate over keys in sorted order
Iterate over keys in sorted order in a complete Rust program using the standard library.
Rust✓ Tested
Join two sorted files by a shared key
Linux Commands: Use join for sorted, simple delimiter-separated records with one row per key.
Linux Commands✓ Tested
List regular files recursively in sorted order
C++: Collect relative paths before sorting because directory iteration order is unspecified.
C++✓ Tested
Locate a value in a sorted array
Java: Use Arrays.binarySearch only after establishing ascending order.
Java✓ Tested
Memoize a sorted copy of state
Memoize a sorted copy of state with a small React component and explicit browser behavior.
React✓ Tested
Merge two sorted arrays
C: Advance the pointer belonging to the smaller next element and copy any remaining suffix.
C✓ Tested
Merge two sorted sequences
C++: Both inputs must use the same ordering before merge is called.
C++✓ Tested
Number a sorted result
Assign a row number without changing stored data.
row_number✓ Tested
Remove adjacent duplicates from a sorted array
C: Compact equal neighbors with a write index after sorting or otherwise establishing order.
C✓ Tested
Search a sorted array efficiently
C#: Array.BinarySearch requires an array sorted with the same comparison rules.
C#✓ Tested
Search a sorted array with bsearch
C: The search uses the same ordering comparator as the sorted input.
C✓ Tested
Search a sorted slice
Search a sorted slice in a complete Rust program using the standard library.
Rust✓ Tested