Question: 5: implement inserting bid into the tree,If root equal to nullptr, Root is equal to new node bid,Else,Add node root and bid6: Implement removing bid
5: implement inserting bid into the tree,If root equal to nullptr, Root is equal to new node bid,Else,Add node root and bid6: Implement removing bid from tree,Remove node root bid i7: implement search tree for bid,Set current node equal to root,Keep loop downwards until bottom is reached or matching bidID found, If match found return currrnt bid,If bid small er then current node then traverse left,If larger traverse right.

Evoid BinarySearchTree: : Preorder () { // FixMe (4) : Pre order root // preorder root Insert a bid Avoid BinarySearchTree: : Insert(Bid bid) { // FIXME (5) Implement inserting a bid into the tree // if root equal to null ptr // root is equal to new node bid // else // add Node root and bid Remove a bid Elvoid BinarySearchTree:: Remove (string bidid) { // FIXME (6) Implement removing a bid from the tree // remove node root bidID Search for a bid Bid BinarySearchTree: : Search(string bidId) { // FIXME (7) Implement searching the tree for a bid // set current node equal to root // keep looping downwards until bottom reached or matching bidId // if match found, return current bid // if bid is smaller than current node then traverse left // else larger so traverse right Bid bid; return bid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
