Thursday 15 March 2012

c++ - preorder an array based binary search tree -


I'm trying to order a BSD, I'm not sure how to do this.

You should consider recurring approaches instead of a recursive one. Tree traversal (preorder, indoor and postorder) is done very easily using recursion.

A pseudoscopy is a recursive algorithm, but there really is not much in it since you are accumulating a tree in an array, you will not have node pointers, just index.

You know that when you reach the nodes of the leaf, all right, their index will be beyond the end of the array.


No comments:

Post a Comment