Question

Draw a 2-4 tree that results from adding the following elements into an initially empty tree:...

Draw a 2-4 tree that results from adding the following elements into an initially empty tree:

34 45 3 87 65 32 1 12 17

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer)

2-4 Tree:

  • Can insert 1 to 3 values at each node.
  • Can have 2 to 4 children pre node.
  • All leaves are must in same depth.

Insert 34

34

Insert 45

34 45

Insert 3

3 34 45

Insert 87, the node becomes 4 key so split in the middle.

3 34 45 87

Middle value 34 is created as a new node and split 3 and 45,87

34 3 45 87

Insert 65, which is greater than 34 so insert at right child.

34 کیا 45 65 87

Insert 32, which is less than 34 so insert at the left of 34.

34 3 32 45 65 87

Insert 1, which is less than 34 so insert at the left of 34.

34 1 لیا 3 32 45 65 | 87

Insert 12, which is less than 34 so insert at the left of 34. But the node becomes 4 key so split in the middle.

34 1 با 32 45 65 87 12

Middle value 3 is move to upper leyar and split 1 and 12,32

3 3 । 34 1 12 32 45 65 87

Insert 17, which is graiter than 3 and less than 34 so insert at middle node.

3 34 1 12 17 32 45 65 87

Add a comment
Know the answer?
Add Answer to:
Draw a 2-4 tree that results from adding the following elements into an initially empty tree:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT