Question
Book Icon
Chapter 21, Problem 20RQE
Program Plan Intro

Binary tree:

  • It is a tree data structure which comes under hierarchical data structure.
  • It is made of nodes that have a left child, right child and a data element.

Tree traversal:

  • There are 3 common methods
    • Inorder traversal
    • Preorder traversal
    • Postorder traversal
  • In inorder traversal, the left subtree is encountered first, then data node and then the right subtree.
  • In preorder traversal, the data node is encountered first, then left subtree and then the right subtree.
  • In postorder traversal, the left subtree is encountered first, then right subtree and then the data node.

Algorithm for Postorder traversal:

  • Traverse through the leftmost subtree and then print the element.
  • Ttraverse the rightmost subtree and then print the element.
  • At last visit and print the root node.

Blurred answer
Students have asked these similar questions
For non-unique search keys, a property was added. How does this affect B+ tree height?
To accommodate search keys that are not unique, a new property was added to the search key. What impact may this modification have on the height of the B+-tree?
Please help with C++ question in image. Thank you.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning