Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BINARY TREE OPERATIONS: 1. Insert a new node (requires two functions) The public function (insertNode) should accept a new customer's name and the number of

image text in transcribed

BINARY TREE OPERATIONS: 1. Insert a new node (requires two functions) The public function (insertNode) should accept a new customer's name and the number of Krabby Patties they ate. This function should create a new TreeNode and fill it with these new values and then call the private function (insert). The insert function (recursive function) inserts the node in the correct position. a. b. 2. Delete a node (requires three functions) a. The public function (remove) accepts a customer's name in order to identify the node that should be removed This function prints, "You are trying to delete [name]." This function will call the private deleteNode function (a recursive function) The deleteNode function tries to find the node that needs deleted. If deleteNode finds the node, it calls the private makeDeletion function. If deleteNode does not find the node, it should print "I'm sorry. That customer can't be found in the Krusty Krab." The makeDeletion function removes the node and reattaches the branches of the tree below the node. b. c. 3. Display names of customers (requires two functions) The public function (displaylnOrder) will call the private overloaded function also called displaylnOrder. The private displaylnOrder accepts a TreeNode as an argument and it is a recursive function which traverses the nodes using the inorder method and prints the customer's name from each node. a. b. 4. Search for a customer The searchNode function accepts the customer's name as an argument and then it will look at each node (traverse the tree) to find the node with that name. If the name is found, the function returns the number of Krabby Patties that customer ate. If not, then it will return -1 instead. a

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 Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

How does qualitative research differ from quantitative research?

Answered: 1 week ago

Question

11. Are your speaking notes helpful and effective?

Answered: 1 week ago

Question

The Goals of Informative Speaking Topics for Informative

Answered: 1 week ago