Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Topic 5: Trees Important concepts: Binary tree from a given pre-order, in-order, post-order, or level-ordered sequence Pre-order, in-order, post-order, level-ordered traversal of a given tree

image text in transcribed

Topic 5: Trees Important concepts: Binary tree from a given pre-order, in-order, post-order, or level-ordered sequence Pre-order, in-order, post-order, level-ordered traversal of a given tree Heap and BST operations (such as insertion and deletion) Example Questions: 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 87 932 4 | 1 b) 16 | 143 | 87 | 9 | 10 | 24 | 1 c) 16 | 14 | 10 | 8 | 193247 d) 16 | 14 | 1047932 | 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions