Earlier quoted context omitted.
https://en.wikipedia.org/wiki/Rope_(data_structure)
That's good for representing the text, but I'm more focused on the part about being able to add X to everything past a particular point very quickly by manipulating parent values.
Ask HN: What are some cool but obscure data structures you know about?
251–260 of 772 posts
Re: Ask HN: What are some cool but obscure data structures you know about?
#252The union-find data structure / algorithm is useful and a lot of fun. The goal is a data structure where you can perform operations like "a and b are in the same set", "b and c are in the same set" and then get answers to questions like "are a and c in the same set?" (yes, in this example.) The implementation starts out pretty obvious - a tree where every element either points at itself or some thing it was merged wi…
Re: Ask HN: What are some cool but obscure data structures you know about?
#253They are useful for checking in O(log(n)) if a number (or string) is in any of n ranges of numbers.
You just keep a sorted list of endpoints of the ranges, and when you do a lookup, you do a binary search if the search value is in the list, and if not, between which two indexes. If it's between and even and an odd index, it's in.
Very useful if you remember that IP addresses are also integers, and with IPv6 networks become way too huge to enumerate.
Re: Ask HN: What are some cool but obscure data structures you know about?
#254Re: Ask HN: What are some cool but obscure data structures you know about?
#255arrays are pretty underground, theyre like lists but better. C++ offers arrays but unfortunately python doesnt :(
There is also this module, which provides unboxed arrays: https://docs.python.org/3/library/array.html
Re: Ask HN: What are some cool but obscure data structures you know about?
#256Cache-Oblivious Data Structures: https://cs.au.dk/~gerth/MassiveData02/notes/demaine.pdf A vaguely related notion is that naive analysis of big-O complexity in typical CS texts ignores over the increasing latency/cost of data access as the data size grows. This can't be ignored, no matter how much we would like to hand-wave it away, because physics gets in the way. A way to think about it is that a CPU core is like a…
Re: Ask HN: What are some cool but obscure data structures you know about?
#257FST is one underappreciated data structure. Its used in places like speech recognition and synthesis, machine translation, optical character recognition, pattern matching, string processing, machine learning, information extraction. If you know about it you exactly know where to use it.
Re: Ask HN: What are some cool but obscure data structures you know about?
#258[1] https://en.wikipedia.org/wiki/Binary_decision_diagram [2] https://apps.dtic.mil/sti/pdfs/ADA470446.pdf
Re: Ask HN: What are some cool but obscure data structures you know about?
#259Spatial hashing. Say that you have data that is identified with points in 2D or 3D space. The standard way that CS students learn in school to represent this is via a quadtree or octree. However, these tree data structures tend to have a lot of "fluff" (needless allocations and pointer chasing) and need a lot of work to be made efficient. Spatial hashing is the stupidly simple solution of just rounding coordinates to…
These data structures have been used in 3D reconstruction methods like CHISEL where they can often outperform octrees due to better memory access behavior.
Re: Ask HN: What are some cool but obscure data structures you know about?
#260Spatial hashing. Say that you have data that is identified with points in 2D or 3D space. The standard way that CS students learn in school to represent this is via a quadtree or octree. However, these tree data structures tend to have a lot of "fluff" (needless allocations and pointer chasing) and need a lot of work to be made efficient. Spatial hashing is the stupidly simple solution of just rounding coordinates to…
This looks like a more modern implementation: https://crates.io/crates/lindel