Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSC 2 2 0 Data Structures Homework # 4 ( follows: L 8 . 1 Binary Search Trees & L 8 . 2 2 -

CSC 220 Data Structures
Homework #4
(follows: L8.1 Binary Search Trees & L8.22-3 Trees)
Name: ____________________________________ Due: Wed, Jan 24th
1.(2pts) Carry out the following operations showing the resulting binary search tree after all operations. Draw the tree in the space to the right of the operations. Assume the tree is initially empty (i.e. the root is null).
a. insert(45)
b. insert(20)
c. insert(30)
d. insert(60)
e. insert(80)
f. insert(70)
g. insert(10)
2.(3pts) Take the same tree from question 1, and show the result of running the following traversal operations. Assume each operation returns the integer values separated by commas as it processes each node.
a. inorder()
b. preorder()
c. postorder()
3.(4pts) Take the same tree from question 1, and show the resulting binary search tree after each of the following operations. After performing the operation, use the resulting tree for the next operation.
a. delete(30)
b. delete(80)
c. delete(45)
d. delete(60)
4.(6pts) Carry out the following operations showing the resulting 2-3 tree after each operation. Assume the tree is initially empty (i.e. the root is null). After performing the operation, use the resulting tree for the next operation.
a. insert(45)
b. insert(20)
c. insert(30)
d. insert(60)
e. insert(80)
f. insert(70)
*(OPTIONAL) For further practice, figure out what the tree would look like if we inserted 65 into the tree from part (f). What if we inserted 75 into the tree from part (f). How about 85? Take the tree from part (f) as the starting point each time. This will help you with cascading splits which may be useful for the exam. For further practice, do the problems from the workbook.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

Results and Conclusion

Answered: 1 week ago