ALL


  Binary tree iterator algorithm

Binary tree pre-order,in-order and post-order traversal are basics in algorithm and data structure.And the recursive binary tree traversal is a classical application of recursion.We define a binary tree node as :// C++struct Node { int value; Node *left; Node *right;}In order binary tree traversal can be:// C++void inorder_traverse(Node *node) { if (NULL != node->left) { inorder_traverse(node->left); } do_something(node); if (NULL != node->right) { inorder_traverse(node->right); }}Easy enough, right? Pre-order and post-order traversal algorithm...

11,883 1       ITERATOR BINARY TREE TRAVERSAL