AVL Tree in Solidity?

npowellnpowell Member Posts: 4
I need an AVL binary tree implemented in solidity for maintaining a list of addresses sorted by a value while having a O(logn) runtime for inserts, deletes and looking up the greatest and least values. Has anyone implemented such a thing in solidity?

Also -- is there some package / library repository for useful data structures or boilerplate contracts?https://en.wikipedia.org/wiki/AVL_tree

Comments

  • npowellnpowell Member Posts: 4
    Also, if the answer is no to the AVL tree already being available, what would you charge me for implementing it, including with full coverage unit tests (I assume there's a way to unit test in Solidity)? You can use this project to help build your street cred, as I would allow you to open source the result (under something like the MIT/Apache license).
  • wb407wb407 Member Posts: 1
    Hi, I was also looking for an implementation (in Solidity) of a B-tree data structure.

    imho, this looks very promising: It's not exactly what I need, but it looks like a very nice place to start. (GPLv3)
  • SeanC52111SeanC52111 Member Posts: 2
    It seems that the rotation in AVL tree can cause heavy gas assumption during the insertion.
Sign In or Register to comment.