SlideShare a Scribd company logo
1 of 1
Download to read offline
For a binary search tree that has a Node with three elements, data, a leftchild pointer and a
rightChild pointer, write the Java code for a recursive find method that accepts a temporary node
and has this signature: private boolean find(Node currentNode, E toFind) {
Solution
private boolean find(Node currentNode, int toFind)
{
if (currentNode != null)
{
}
else
{
private boolean find(Node currentNode, int toFind)
{
if (currentNode != null)
{// check if current node has the element we are looking forif (currentNode.data == toFind)
return true;
}
else
{// check if the sub treesreturn find(currentNode.left, toFind) || find(currentNode.right,
toFind);}}return false;}

More Related Content

More from pristiegee

Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfFill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfpristiegee
 
How financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfHow financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfpristiegee
 
Hello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfHello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfpristiegee
 
Give the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfGive the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfpristiegee
 
Find the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfFind the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfpristiegee
 
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfEach student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfpristiegee
 
describe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfdescribe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfpristiegee
 
Develop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfDevelop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfpristiegee
 
Consider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfConsider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfpristiegee
 
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfAssembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfpristiegee
 
A) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfA) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfpristiegee
 
A T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfA T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfpristiegee
 
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfA nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfpristiegee
 
A directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfA directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfpristiegee
 
Write a program in C++ to get the Make and Model of the ten cars as .pdf
Write a program in C++ to get the Make and Model of the ten cars as .pdfWrite a program in C++ to get the Make and Model of the ten cars as .pdf
Write a program in C++ to get the Make and Model of the ten cars as .pdfpristiegee
 
Write a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfWrite a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfpristiegee
 
Which plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfWhich plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfpristiegee
 
1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdfpristiegee
 
Which of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfWhich of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfpristiegee
 
what motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfwhat motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfpristiegee
 

More from pristiegee (20)

Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfFill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
 
How financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfHow financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdf
 
Hello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfHello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdf
 
Give the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfGive the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdf
 
Find the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfFind the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdf
 
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfEach student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
 
describe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfdescribe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdf
 
Develop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfDevelop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdf
 
Consider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfConsider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdf
 
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfAssembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
 
A) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfA) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdf
 
A T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfA T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdf
 
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfA nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
 
A directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfA directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdf
 
Write a program in C++ to get the Make and Model of the ten cars as .pdf
Write a program in C++ to get the Make and Model of the ten cars as .pdfWrite a program in C++ to get the Make and Model of the ten cars as .pdf
Write a program in C++ to get the Make and Model of the ten cars as .pdf
 
Write a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfWrite a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdf
 
Which plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfWhich plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdf
 
1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf
 
Which of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfWhich of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdf
 
what motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfwhat motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdf
 

Recently uploaded

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

For a binary search tree that has a Node with three elements, data, a.pdf

  • 1. For a binary search tree that has a Node with three elements, data, a leftchild pointer and a rightChild pointer, write the Java code for a recursive find method that accepts a temporary node and has this signature: private boolean find(Node currentNode, E toFind) { Solution private boolean find(Node currentNode, int toFind) { if (currentNode != null) { } else { private boolean find(Node currentNode, int toFind) { if (currentNode != null) {// check if current node has the element we are looking forif (currentNode.data == toFind) return true; } else {// check if the sub treesreturn find(currentNode.left, toFind) || find(currentNode.right, toFind);}}return false;}