Piposort
Sorts an array with a memory-efficient merge sort variant.
Module: Std::Sort
Signature
rux
func Piposort(arr: *int, len: uint);
func PiposortUint64(arr: *uint64, len: uint);Parameters
| Name | Type | Description |
|---|---|---|
arr | *int / *uint64 | Pointer to the first element. |
len | uint | Number of elements to sort. |
Description
A variant of Quadsort that uses less auxiliary memory (about half the array size) while keeping good performance. If its temporary allocation fails, it falls back to Quadsort. Useful when memory is tight; for most code, Sort is the simpler choice.
WARNING
The *int form compares values as unsigned — see the module overview.
Example
rux
import Std::Sort;
Sort::Piposort(items.data, items.length);