Consider the traversals of a tree:
Preorder → ABCEIFJDGHKL
Inorder → EICFJBGDKHLA
Which of the following is the correct postorder traversal?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. IEJFCGKLHDBA
Explanation
A is the root with only a left subtree rooted at B. B's left subtree is C (left E with right child I, right F with right child J). B's right subtree is D (left G, right H with children K, L). Postorder: I E J F C G K L H D B A.More Data Structures and Algorithms questions
- How many rotations are required during the construction of an AVL tree if the following elements are inserted in the given sequence? 35, 50…
- Consider the following undirected graph with vertices a, b, c, f, g, h and edges: a–b, a–c, a–f, b–c, b–f, b–h, c–g, f–g, f–h, g–h The foll…
- Consider the following algorithms and their running times. Which one of the following is correct?List I List II A. Breadth-first search I.…
- Consider the following statements on approximation algorithms: Statement I: APPROX-VERTEX-COVER is a polynomial-time 2-approximation algori…
- Which of the following is used to determine the cost performance index?
- Software project manager is responsible for the following task: (A) Project planning (B) Project status tracking (C) Resources management (…