for preorder traversal in the worst case the


For preorder traversal, in the worst case, the stack will rise to size n/2, where n refer to number of nodes in the tree. Another method of traversing binary tree non-recursively that does not employ stack requires pointers to the parent node (called threaded binary tree).

A threaded binary tree is a binary tree wherein every node which does not have a right child has a THREAD (a third link) to its INORDER successor. By doing this threading we ignore the recursive method of traversing a tree and employ of stack, that makes use of many memory and time.

A node structure of threaded binary is following :

For a threaded binary tree the node structure varies a bit and its like this -

struct NODE *leftchild;

int node_value;

struct NODE *rightchild;

struct NODE *thread;  /* third pointer to its inorder successor */

}

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: for preorder traversal in the worst case the
Reference No:- TGS0263981

Expected delivery within 24 Hours