sortediterable
A sortediterable is a term used to describe an iterable that yields its elements in non-decreasing order according to a defined comparator. It may be a concrete sequence that has been sorted (such as a list or tuple after applying a sort operation) or a generator or stream that produces values in sorted order without storing all elements.
- Order: The iteration proclaims a total order on elements; duplicates may be present and are produced
- Form: It need not be a random-access sequence. A sortediterable can be any iterable that guarantees
- Production: The sorted order can result from pre-sorting a source collection or from a data source
- Binary search: Performing binary search typically requires random-access sequences; a generic sortediterable may not support indexing
- Merging and range queries: When merging multiple sortediterables, a linear-time multi-way merge is possible by repeatedly
- Efficiency: If the source is not stored in sorted form, creating a sortediterable incurs sorting costs
- In many languages and libraries, the exact term sortediterable is informal. Some ecosystems provide protocols or
- Common related concepts include sorted containers, sorted sequences, and generic merge algorithms. The standard library often
See also: sorted containers, sequences, iterables, merge, bisect.