Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 Question 2 Question 3 50 50,30 50,30,25 ... Question 4 preo rder in o

ID: 3551787 • Letter: Q

Question


Question 1

Question 2

Question 3

50
50,30
50,30,25
...



Question 4

preo rder

in order

post order

All orders use the stack equally

Question 5

Question 6

Question 7

Question 8

Question 9

Question 10

Question 11

Question 12

Question 13

preo rder

in order

post order

All orders use the stack equally

Question 5

  1. What is the level of node 65 in Figure 11-35 in Page 679?

Question 6

  1. Consider a binary tree with pre-order sequence M-K-L-P-A-N-D, and in-order sequence L-K-M-A-P-N-D. Which item is in the right child of the root node?

Question 7

  1. Consider a binary tree with post-order sequence m-k-s-p-q-v-a, and in-order sequence k-m-a-p-s-v-q. Which item is in the left child of the root node?

Question 8

  1. How many unique binary trees are there that generate M-K-L as the pre-order sequence and K-L-M as the post-order sequence?

Question 9

  1. Write the pre-order sequence for the binary tree given in Figure 11-37 in page 680. Simply use comma with no spaces to write the list.

Question 10

  1. Write the post-order sequence for the binary tree given in Figure 11-37 in page 680. Simply use comma with no spaces to write the list.

Explanation / Answer

<<1>> 
  1. #include<iostream>
  2. using namespace std;
  3. struct tree
  4. {
  5. int data;
  6. tree *left, *right;
  7. };
  8. int main()
  9. {
  10. cout<<5*sizeof(tree); // since, 5 nodes are being stored
  11. return 0;
  12. }
using namespace std; struct tree { int data; tree *left, *right; }; int main() { cout<<5*sizeof(tree); // since, 5 nodes are being stored return 0; } Success 0s 3296KB
stdin :
empty
stdout :
60 Hence storage space = 60 bytes (Ans). -------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<2>>
50,80,55,58,70,65
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<3>>
50 50,30 50,30,25 50,30,25 50,30 50 50,40 50 50,48 50,48,45 50,48 50 80 80,55 80,55,52 80,55 80 80,58 80 80,70 80,70,65 80,70 80 80,79 80,79,75 80,79 80 98 98,85 98 110 110,90 110 (empty)  // traversed whole tree. As, we can see number of elements in stack doenot exceed 3. Hence maximum no. of elements in stack = 3 . -------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<4>>
Postorder
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<5>>
Ans=5.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<6>>
P
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<7>>
K
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<8>>
5
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<9>>
50,30,25,40,48,80,55
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<10>>
25,48,40,30,55,80,50
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<11>>
D,C,B,E,A,F,G
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<12>>
85
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<13>>
48
----------------------------------------------------------------------Done Cheers :)------------------------------------------------------------------------ 50 50,30 50,30,25 50,30,25 50,30 50 50,40 50 50,48 50,48,45 50,48 50 80 80,55 80,55,52 80,55 80 80,58 80 80,70 80,70,65 80,70 80 80,79 80,79,75 80,79 80 98 98,85 98 110 110,90 110 (empty)  // traversed whole tree. As, we can see number of elements in stack doenot exceed 3. Hence maximum no. of elements in stack = 3 . -------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<4>>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<4>>
Postorder Postorder
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<5>>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<5>>
Ans=5.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<6>>
P
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<7>>
K Ans=5.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<6>>
P
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<7>>
K
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<8>>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<8>>
5
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<9>>
50,30,25,40,48,80,55
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<10>>
25,48,40,30,55,80,50
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<11>>
D,C,B,E,A,F,G
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<12>>
85
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<13>>
48
----------------------------------------------------------------------Done Cheers :)------------------------------------------------------------------------ 5
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<9>>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<9>>
50,30,25,40,48,80,55 50,30,25,40,48,80,55
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<10>>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<10>>
25,48,40,30,55,80,50 25,48,40,30,55,80,50
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<11>>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<11>>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<11>>
D,C,B,E,A,F,G
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<12>>
85
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<13>>
48
----------------------------------------------------------------------Done Cheers :)------------------------------------------------------------------------ D,C,B,E,A,F,G
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<12>>
85
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<13>>
48
----------------------------------------------------------------------Done Cheers :)------------------------------------------------------------------------ D,C,B,E,A,F,G
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<12>>
85
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<13>>
48
----------------------------------------------------------------------Done Cheers :)------------------------------------------------------------------------
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote