Description
Explanation & Answer
Let us add the words to the bunary search tree with the condition of using alphabetic order of letters in case of any clashes
Lust
/ \
Gluttony. Sloth
/ \ / \
Envy Greed. Pride Wrath
Lust is the root.
Gluttony start s with g<l so it becomes left child.
Greed has second letter r>l so it becomes right child of gluttony.
Sloth has s>l of lust hence it is right child of list.
Wrath has w>s hence its right child of sloth.
Envy has e<g hence its left child if gluttony.
Pride has p>l of list but p<s of sloth hence it becomes left child of sloth.
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!