A few easy questions about trees. If you have to store the data from a binary tr
ID: 3575140 • Letter: A
Question
A few easy questions about trees.
If you have to store the data from a binary tree of height 6 into an array, what is the maximum the maximum size of the array you will need? Show how you arrive at your answer. If this array has a value located in cell 35, then which cell will hold its parent and is this node the left or the right child of that parent? If you had to write a program for a Bank consisting of a database, what data structure will you choose (to store data from the database) and why?Explanation / Answer
8)
Binart tree have atmost 2 child
At root we have 1 node ,next level contain 2^h nodes so 2 nodes ,next level contains 2^h nodes so 4 nodes and so on
Adding these nodes we get formula n = 2^(h+1) -1
Since h=6;
Ans=127;
9) assuming index start from 0;
Parent=child/2;
Parent=35/2=17;
As 35 is odd no therefore it is left child;
10)Array of structures is used in databases program because insertion ,deletion is quick and easy in array .
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.