3 ms·
I kind of like data structures, because when you study them, and take them apart, and understand their pieces, rather than seeing the world as Prolly Trees here
by jerf 1y ago
I kind of like data structures, because when you study them, and take them apart, and understand their pieces, rather than seeing the world as Prolly Trees here and Binary Trees there and Bloom Filters over there, you see a whole bunch of little tricks you can use, and when you collect a reasonably large bag of those tricks you can put them together in all sorts of ways.
It's almost a pity computers are as fast as they are and they are so rarely needed because having "arrays" and "maps/dicts/associative arrays/whatever" solves so many problems so much faster than we need anyhow. I don't get to pull out the bag of tricks very often. But then again, when I do, it's because it's a life saver and the difference between success and failure, so maybe it all balances out.
- shadowgovt 1y agoIt's fun to go look at the actual implementation of those primitives in languages and libraries and see how complex they can be under the hood. Some of them incorporate two or three algorithms and switch them on the fly based on profiling the incoming data. I remember being startled to learn that Cocoa's "NSString" supports ropes, caching of transforms, and I think even some translation primitives, all quietly switching on and off as needed. Developers have less control over the particulars (and may miss optimization opportunities if they can make guarantees about the shape of the problem) but it benefits the common case.