Support Binary Search Tree in Solidity

Hi there, I found two examples of binary search tree written in Solidity given below and I'm wondering if OpenZeppelin has any plan implementing a formal version of this extremely useful data structure. Thanks.

1 Like

Hey @maxareo,

We currently don't have plans to support a binary tree data structure but are open to it if there's a demanded general use case that we can fit in the library.

Seems like the HitchensOrderStatisticTreeLib is too specialized and is unclear what the BinaryTree would be used for. Do you know concrete popular use cases of binary trees out there?

I thought Binary Search Tree is a fundamentally useful data structure in maintaining a sorted array of values such that fast verification, insertion and retrieval can be done in O(1) complexity. I could not think of a use case immediately, but given how fundamental this truly is, it may open up many use cases, just like how this sorted double linked list made the project Liquity possible.