Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello i have a question i need help with so i want to search and return a value from binary search tree but i have

hello i have a question i need help with so i want to search and return a value from binary search tree but i have a problem every time i try to print the result it keeps giving me a null value so i will drop down my code please read it and tell what is my mistake or write me the code that i should add note** i have a treeNode class and tree class so i want the to solve the problem with this way not the one's that have a key and lablablah....the class treeNode has {data,leftChild,rightChild} and the tree calss has {root}

image text in transcribedimage text in transcribedimage text in transcribed

public TreeNode get(int value) { //if we find it in the root if(value==data){return this;} //if the value is smaller then we will search in the left side as we know the left side is always smaller if(value Main (3) [Java Application] C:\Program Files\Java\jdk-17\bin\javaw.exe (27 Dec 2021, 20:12:43 20:12:43) value is null value is null value is null

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

TV Commercial TV Commercial

Answered: 1 week ago