Closed lancejpollard closed 2 years ago
Hello @lancejpollard,
O(n)
since you need to reindex everything that comes after. So my question is more: what is your use case here? Why are you using a HAT in the first place?Cool, thanks. I am just exploring, playing around with the idea of using something like this for a dynamic array in a custom programming language. I am new to these sorts of data structure implementations though.
HATs are usually used for very specific scenario were their theoretical performance can match real-life one. People usually rely on growing arrays such as mnemonist's Vector for generic implementation as they remain very efficient because of contiguous memory allocation and cache reasons, in spite of the amortized cost being theoretically worse that HATs.
Thanks for the helpful info!
Oh I didn't realize how many data structures you had! Could you briefly list out what the best use cases are for a few? I am working on implementing the primitives and core "data structures" I guess for that programming language, and it would be awesome to know what could be used where.
For a long time I was thinking of making the generic structure a B+tree, as databases are implemented using it. But in-memory databases (like PebbleDB) also use SkipLists instead. But you and others have hinted recently that dynamic arrays would be better, and perhaps a hash table. But I'm curious to learn more use cases for these things in practicality.
Can you point in the right direction how to implement these sorts of 3 methods in the HashedArrayTree? I would like to use this for a dynamic array implementation, but I think it would need to have these methods as well. Thanks!