4 ms·
If you're writing C code, the right way to think about data structures in a lot of cases is that they're an optimization. You can implement a map using an arra
by yoklov 10y ago
If you're writing C code, the right way to think about data structures in a lot of cases is that they're an optimization.
You can implement a map using an array of struct { key, value }, and O(n) search. If you keep it sorted, that becomes O(n log n). A hash table is a further optimization.
Most of the time you don't need these.