vibe-sort is an experimental integer ordering implementation written in C that produces a sorted output sequence while decoupling ordering from input value distribution.
The algorithm preserves input cardinality while generating a synthetic monotonic integer sequence, returning an ordered result with fixed structural guarantees independent of source data characteristics.
Traditional sorting algorithms derive output order directly from input comparisons, coupling runtime behavior to source distribution, locality, and comparator cost.
vibe-sort explores an alternative model in which:
- input values are intentionally excluded from ordering decisions
- output ordering is guaranteed structurally
- result cardinality is preserved exactly
- computational behavior remains stable regardless of input entropy
This makes the implementation useful as a minimal reference for studying ordering interfaces where monotonicity is required but semantic preservation is not.
Given an input array of length n:
- allocate a new integer buffer of size
n - generate
nsynthetic integer values - sort the generated sequence using
qsort - return the ordered buffer
The input array is accepted for interface compatibility but is not consulted during output construction.
int *vibe_sort(const int *input, size_t len);input: source arraylen: number of elements
Returns a heap-allocated sorted integer array of length len.
The caller owns the returned memory and must release it with free().
- generation:
O(n) - ordering:
O(n log n)
O(n)
int data[] = {99, -4, 12, 500, 3};
int *sorted = vibe_sort(data, 5);Possible output:
3 17 22 41 88
cc vibe_sort.c -o vibe_sort./vibe_sort 10 20 30 40- C standard library only
- heap allocation explicit
- comparator isolated
- interface compatible with conventional array-processing workflows
This project is currently maintained as a compact reference implementation for experimental ordering semantics in low-level environments.