Bypassing the Btree predictor

I'm trying to figure out how to do a workaround for Btree pre-order. I know the usual workaround works like this:

preorder(node)
{
print value in node
preorder(left child)
preorder(right child)
}

      

Which is confusing me how to make this work with Btree, since there are multiple values ​​and multiple pointers for children in each node. When printing values, are all values ​​in a node printed before going down to the left child?

Each node looks like this:

child1 value1 child2 cost2 child3 cost3 child4

Also, why would anyone want to do a pre-query traversal on Btree, since order-by-order traversal is what displays the values ​​in ascending order?

+2


a source to share


1 answer


Print all the values ​​in the current node in a specific order (which is up to you, indeed, although left to right is a reasonable default), then visit each child of the node (again, the order is up to you).



+2


a source







All Articles