Hello every one,

I Request you to kindly provide me the description of Tree and its traversal meothds of using iterative.

i tried for all recursive ones but this one i cant get.

how to get back to the parents nodes when printing in inorder and post order methods.

how to find the height of the binary tree?


Thanks,
Gaiety.

Recommended Answers

All 3 Replies

ok

i have the code. but i shall send it to u tomorrow. bcz i dnt have it rite now. its on my desktop pc. and i m on laptop now.

push the parent node into a stack before going to a child. after returning back just pop the parent.


i shall send u complete code for tree height and traversals tomorrow.

Do we need to make any changes in the structure of tree , i mean any extra pointers in the structure declaration to hold the parent address when going down the tree.

And i also have confusion regarding height of the tree and depth of the tree.

finding the height of the tree.

how to check a given tree is balanced

i am confused with the definitions itself.


Request you to do the need.

thanks,
Gaiety

Do we need to make any changes in the structure of tree , i mean any extra pointers in the structure declaration to hold the parent address when going down the tree.

Having parent pointers can help make the code simpler, and you do not need to worry about managing a separate stack. But parent pointers also take up space in each node and might not be practical all of the time.

i am confused with the definitions itself.

Height and depth. So the depth refers to a single node and the height refers to the entire tree.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.