Question
please try to solve all with explain Q1: Given a binary tree, which traversal type would print the values in the nodes in sorted order?
please try to solve all with explain
Q1: Given a binary tree, which traversal type would print the values in the nodes in sorted order? a) Pre-Order Traversal b) Post-Order Traversal c) In-Order Traversal d) None of the above Q2: A heap is represented using an array. Which of the following arrays corresponds to a heap? a) 16 | 14 | 10 | 8 | 7 | 9 | 3 | 2 | 4 | 1 b) 16 | 14 | 3 | 8 | 7 | 9 | 10 | 2 | 4 | 1 c) 16 | 14 | 10 | 8 | 1 | 9 | 3 | 2 | 4 | 7 d) 16 | 14 | 10 | 4 | 7 | 9 | 3 | 2 | 8 | 1 e) None of the above satisfies heap conditions! Q3: In an array representation of a binary tree, if a node is stored at index 3, the left child of the node will be at index a) 5 b) 6 c) 7 d) 8 e) Other: Q4: Which of the following properties are obeyed by all three tree traversals? a) Left subtrees are visited before right subtrees b) Right subtrees are visited before left subtrees c) Root node is visited before left subtree d) Root node is visited before right subtree Q5: Construct a binary search tree with the below information: The preorder traversal of a binary search tree 10, 4, 3, 5, 11, 12. Q6: Construct a binary tree using the following data: The preorder traversal of a binary tree is 1, 2, 5, 3, 4. The inorder traversal of the same binary tree is 2, 5, 1, 4, 3. Q7: Construct a binary tree by using postorder and inorder sequences given below. Inorder: N, M, P, O, Q Postorder: N, P, Q, O, M Q8: Construct a binary tree using inorder and level order traversal given below. Inorder Traversal: 3, 4, 2, 1, 5, 8, 9 Level Order Traversal: 1, 4, 5, 9, 8, 2, 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started