Function diem_types::proof::position::inorder_to_postorder
source · pub fn inorder_to_postorder(node: u64) -> u64
Expand description
Given node
, an index in an in-order traversal of a perfect binary tree,
what order would the node be visited in in post-order traversal?
For example, consider this tree of in-order nodes.
3
/ \
/ \
1 5
/ \ / \
0 2 4 6
The post-order ordering of the nodes is:
6
/ \
/ \
2 5
/ \ / \
0 1 3 4
post_order_index(1) == 2 post_order_index(4) == 3