Every programmer should spend time building all the fundamental data structures from scratch (dynamically resizable array, hashmap, linked list) Actually learning how they work and the specific implementation tricks is 10x more valuable than just knowing their Big O complexity
Every programmer should spend time building all the fundamental data structures from scratch (dynamically resizable array, hashmap, linked list) Actually learning how they work and the specific implementation tricks is 10x more valuable than just knowing their Big O complexity
I recommend doing this in C (or in Zig, or even Rust but with unsafe) because actually managing memory plays a role in how these data structures are designed
And I recommend looking and learning what the industry standard implementations are, you'll learn about the different tradeoffs in performance etc. (particularly for hashmap)
Fresh. Frozen. Limited.
@zack_overflow and just not doing it generic since it's "only for education", i dunno about that. there are pretty different perf tradeofs when storing just ints opposed to storing potentially huge structs with expensive or no copy and destructor that must be run on clear for every element etc.
@zack_overflow managing memory is one thing, but designing the interface to make it pleasant to use, generic and also encourage using it in a performant way is just as important and C is terrible at that
@zack_overflow Zig's "std.ArrayList" is the GOAT
@zack_overflow Any learning material references on how managing the memory?
@zack_overflow I once wrote an intrusive xor linked list. had to do terrible black magic with macros and gcc extensions to make it generic. the result worked but was pain to read and compiler error messages on user error were like 10 times more cryptic than you'd get even with C++ templates xxD