Does storing/searching/writing binary tree is efficient enough from gas perspective? Let say I have node A. and new node B. node B should be placed at the first available place in the subtree starting from Node A. After that, we need traverse from node B to root node and update the count field for all nodes
Also, does any lib exist for such data structure?
You can use an array-like rep for Tree.
FYI: https://github.com/tronprotocol/java-tron/blob/feature/shieldedUSDT/deploy/ShieldedTRC20.sol