Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please i need the answer to the whole question. this question has not been asked before so dont use a similar solution. thank you. in

please i need the answer to the whole question. this question has not been asked before so dont use a similar solution. thank you.

in c++ create code that does the following(binary search tree)

1 void add(string); // add string in search tree

2 int preorderTrav(node*) // pre order traversing

3 leafcount(node*) //counts number of leaves in search tree

4 void nodeSibling(string) // finds the sibling nodes

5) void searchBT(string) // searches for a node and displays sibling nodes

example of run

Enter your choice <1-4>: 1

enter number of items to add: 4

enter node: KAM

inserted

enter node: PAM

inserted

enter node: DON

inserted

enter node: TOM

inserted

enter your choice <1-4> : 2

node info travsersing preorder right child

left child info

_________ _____________ ___________

KAM DON PAM

DON NIL NIL

PAM NIL TOM

TOM NIL NIL

(print out NIL when a node does not have a child to display)

Enter your choice<1-5> :3

there are___________ number of leaves in the binary search tree

Enter your choice<1-5>: 4

enter a name and it will display the sibling of that person:

the sibling of __pam_ is _don__

Enter your choice<1-5>: 5

Enter a node to search: KAM

node info left child right child

_______ ___________ ___________

KAM DON PAM

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions