Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A - Consider a binary search tree ( BST ) . Assume that the keys are integers and no value ( objects ) other

Part A- Consider a binary search tree (BST). Assume that the keys are integers and no value (objects) other than the key is stored in each node. By following the explanations and examples given in class, design an algorithm in pseudo-code for operation remove(k). Use java programming language, implement the BST ADT in a linked structure, along with the following operations: search, insert and remove.
Part B- Implement the InOrder traversal strategy, which shows the keys of the BST in increasing order.
Following the InOrder traversal strategy, write a program (or a method) that draws the BST and shows it on the screen (either console or GUI screen is acceptable).
Part C-Insert 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 in the tree (in that order). Show all keys in the tree (for this and the following, use the InOrder traversal method you implemented in Part B).
Perform search(1) and search(15)100,000 times and record the CPU time taken by each of these.
Remove key 5. Show all keys in Inorder traversal. Remove 15. Show all the keys in Inorder traversal. Remove 1. Show all the keys in Inorder traversal. Insert key 2. Show all keys in Inorder traversal.

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

Students also viewed these Databases questions