4 ms·
Could someone give an example where this data structure would be useful?
by rohmbus 10y ago
Could someone give an example where this data structure would be useful?
- willtim 10y agoYou can create a persistent ordered container that has both prepend and append in amortised constant time; and concatenate in log time.
- geocar 10y agoCaching isn't great though. Pagetables are a trie, so it's max log log log time to prepend, append, or concatenate, and usually constant small for two of them (but admittedly: you usually have to pick if you don't know how many arrays you want).
- greydius 10y agoThey can be used to implement an immutable deque.
- ianleeclark 10y agoThey're used in a distributed hash table implementation called chord (https://en.wikipedia.org/wiki/Chord_(peer-to-peer) https://en.wikipedia.org/wiki/Chord_(peer-to-peer)
- markc 10y agoThere are several use-case examples in the Readme for this Clojure finger tree implementation: https://github.com/clojure/data.finger-tree https://github.com/clojure/data.finger-tree
- KingMob 10y agoJust want to add that the data structure behind all of Clojure's default data types are finger trees.
- KingMob 10y agoThey're excellent general purpose structures for data sharing of immutable data (e.g., a slightly-changed copy shares much of the same data as the original). Clojure uses them extensively, since immutable data has the nice property of being thread-safe by default.