←back to thread

20 points habedi0 | 1 comments | | HN request time: 0s | source

I made an early version of a sorted collection library for Zig. Sorted collections are data structures that maintain the data in sorted order. Examples of these data structures are `java.util.TreeMap` in Java and `std::map` in C++. These data structures are mainly used for fast lookups (point search) and fast range searches.

The library is available on GitHub: https://github.com/CogitatorTech/ordered

Show context
masklinn ◴[] No.45729981[source]
… why are you calling it ordered when it’s sorted rather than, well, ordered?
replies(3): >>45730075 #>>45730682 #>>45734693 #
LandR ◴[] No.45730682[source]
Whats the difference between ordered and sorted ?
replies(2): >>45730750 #>>45734731 #
1. 4b11b4 ◴[] No.45734731[source]
order is a general concept which builds on top of the concept of equality. If they are not equal, then what are they? We can manually define an order for a type to determine which is lesser or greater. once you have this rule (the order), then you can sort

effectively you could think of them the same, or that sorting is an application of using the order rules for a given type