Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Construct a binary tree from a hash Table using vectors. The hash Table should be a vector . Where vector is a vector of 3

Construct a binary tree from a hash Table using vectors. The hash Table should be a vector>>.

Where vector is a vector of 3 numbers with the first number being the parent node and the second number is the left child and the third number is the right child in the tree.

Next, vector> is the list of all vector.

Finally, the hash table is the vector>>.

0 1 2

1 3 4

....

9 -1 -1

The rst number is the parentnode ID, the second number is the left child node ID, the third number is the right childnode ID. For example, in the line of 0 1 2, the node 0 is the parent of node 1 and node 2,and node 1 is the left child of node 0, node 2 is the right child of node 2. If a node does nothave a left/right child, then the second/third number will be -1. For example, in the line of4 9 -1, the node 4 has only a left child (node 9) but has not a right child. In the line of 9 -1-1, the node 9 does not have a left or a right child.

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions