1/alichraghi/zort v0.2
a lot of sorting algorithms written in zig
Zort
implemention of 9 sorting algorithm in Zig
| Algorithm | ASC | DESC | Zero Allocation |
| ------------ | ------------- | ------------- | ------------- |
| Quick | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Insertion | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Selection | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Bubble | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Shell | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Comb | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Heap | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Merge | :heavy_check_mark: | :heavy_check_mark: | :x: |
| Radix (positive number) | :heavy_check_mark: | :white_check_mark: (mem.reverse
) | :x: |
benchmark result:
'quick' ran
1.18 ± 0.21 times faster than 'std_block'
1.06 ± 0.20 times faster than 'radix'
1.24 ± 0.21 times faster than 'comb'
1.33 ± 0.22 times faster than 'shell'
1.44 ± 0.26 times faster than 'heap'
106.11 ± 13.74 times faster than 'merge'
153.15 ± 19.84 times faster than 'std_insertion'
165.51 ± 22.83 times faster than 'insertion'
243.00 ± 31.52 times faster than 'selection'
477.22 ± 62.45 times faster than 'bubble'
Usage:
const zort = @import("zort");
pub fn main() !void {
var arr = [_]u8{ 9, 1, 4, 12, 3, 4 };
try zort.sort(u8, &arr, false, .Quick, null);
}
thx from @der-teufel-programming for answering my questions
Package Contents
- zort.zig
- .gitattributes
- LICENSE
- bench.sh
- build.zig
- zigmod.yml
- benchmark.zig
- README.md
- .gitignore
History
Published On | Tree @ Commit | Size | |
---|---|---|---|
v0.18 | Thu, 19 May 2022 15:22:44 UTC | Tree | 27.198 KB |
v0.17 | Thu, 19 May 2022 15:17:40 UTC | Tree | 27.758 KB |
v0.16 | Thu, 19 May 2022 15:08:25 UTC | Tree | 27.285 KB |
v0.15 | Thu, 19 May 2022 14:10:51 UTC | Tree | 27.107 KB |
v0.14 | Sat, 07 May 2022 05:36:29 UTC | Tree | 29.861 KB |
v0.13 | Wed, 04 May 2022 14:45:20 UTC | Tree | 29.380 KB |
v0.12 | Mon, 02 May 2022 10:54:12 UTC | Tree | 61.833 KB |
v0.11 | Mon, 02 May 2022 10:49:59 UTC | Tree | 61.833 KB |
v0.10 | Sat, 23 Apr 2022 15:57:47 UTC | Tree | 52.633 KB |
v0.9 | Sun, 20 Mar 2022 18:47:44 UTC | Tree | 52.641 KB |
v0.8 | Sun, 20 Mar 2022 11:38:52 UTC | Tree | 52.973 KB |
v0.7 | Fri, 18 Mar 2022 16:32:02 UTC | Tree | 50.603 KB |
v0.6 | Fri, 18 Mar 2022 16:31:29 UTC | Tree | 50.733 KB |
v0.5 | Fri, 18 Mar 2022 16:27:12 UTC | Tree | 50.733 KB |
v0.4 | Fri, 18 Mar 2022 16:24:57 UTC | Tree | 50.765 KB |
v0.3 | Fri, 18 Mar 2022 16:21:29 UTC | Tree | 50.672 KB |
v0.2 | Thu, 17 Mar 2022 11:35:28 UTC | Tree | 19.215 KB |
v0.1 | Wed, 16 Mar 2022 16:50:48 UTC | Tree | 19.215 KB |