Assume that a binary tree is to be stored in main memory as follows: Each node i
ID: 2831162 • Letter: A
Question
Assume that a binary tree is to be stored in main memory as follows: Each node
in the tree is stored using 3 consecutive memory locations. The first holds the key
value of the node (a letter here), the second contains a pointer to the node's left
child and the third contains a pointer to the right child.
The binary tree is:
E
G B
D F A
Given the contents of memory below, fill in the pointer fields to represent the
binary tree. Use -1 to represent the null pointer. (7 points)
Address Contents
30 A
31 ?
32 ?
33 D
34 ?
35 ?
36 F
37 ?
38 ?
39 G
40 ?
41 ?
42 E
43 ?
44 ?
45 B
46 ?
47 ?
Explanation / Answer
17.
Address Contents
30 A
31 -1
32 -1
33 D
34 -1
35 -1
36 F
37 -1
38 -1
39 G
40 -1
41 33
42 E
43 39
44 45
45 B
46 36
47 30
Dude im doing this exact assignment!This what i got.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.