Quadsort
Sorts an array with a stable merge-based algorithm.
Module: Std::Sort
Signature
rux
func Quadsort(arr: *int, len: uint);
func QuadsortUint64(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 stable, adaptive merge sort: equal elements keep their original relative order, and nearly-sorted inputs are handled quickly. It allocates a temporary buffer during the sort. Choose Quadsort when stability matters or the data is already partially ordered; otherwise Sort selects a good algorithm automatically.
WARNING
The *int form compares values as unsigned — see the module overview.
Example
rux
import Std::Sort;
Sort::Quadsort(items.data, items.length);