SlideShare a Scribd company logo
1 of 3
Please finish everything marked TODO.
BST.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class BST<E extends Comparable<E>> implements Tree<E> {
private int height;
private int size;
private BinaryNode<E> root;
public BST(){
this.root = null;
this.height = 0;
this.size = 0;
}
// TODO: BST
public BST(BinaryNode<E> root){
}
// Access field
public BinaryNode<E> root() {
return this.root;
}
// Basic properties
public int height() {
return this.height;
}
public int size() {
return this.size;
}
public boolean isBalanced() {
return root.isBalanced();
}
// TODO: updateHeight - Update the root height to reflect any changes
public void updateHeight() {
}
// Traversals that return lists
// TODO: Preorder traversal
public List<E> preOrderList() {
return new ArrayList<>();
}
// TODO: Inorder traversal
public List<E> inOrderList() {
return new ArrayList<>();
}
// TODO: Postorder traversal
public List<E> postOrderList() {
return new ArrayList<>();
}
// Helpers for BST/AVL methods
// TODO: extractRightMost
// This will be called on the left subtree and will get the maximum value.
public BinaryNode<E> extractRightMost(BinaryNode<E> curNode) {
return null;
}
// AVL & BST Search & insert same
// TODO: search
public BinaryNode<E> search(E elem) {
return null;
}
// TODO: insert
public void insert(E elem) {
}
// TODO: delete
public BinaryNode<E> delete(E elem) {
return null;
}
// Stuff to help you debug if you want
// Can ignore or use to see if it works.
static <E extends Comparable<E>> Tree<E> mkBST (Collection<E> elems) {
Tree<E> result = new BST<>();
for (E e : elems) result.insert(e);
return result;
}
public TreePrinter.PrintableNode getLeft() {
return this.root.hasLeft() ? this.root.left() : null;
}
public TreePrinter.PrintableNode getRight() {
return this.root.hasRight() ? this.root.right() : null;
}
public String getText() {
return (this.root != null) ? this.root.getText() : "";
}
}

More Related Content

Similar to Please finish everything marked TODO- BST-java import java-util-Arra.docx

can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
sales88
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
gudduraza28
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
aksahnan
 
For this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docxFor this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docx
mckellarhastings
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
dbrienmhompsonkath75
 
Please fix my errors class Iterator public Construc.pdf
Please fix my errors   class Iterator  public  Construc.pdfPlease fix my errors   class Iterator  public  Construc.pdf
Please fix my errors class Iterator public Construc.pdf
kitty811
 
The following is to be written in JavaThe following is the BSTree.pdf
The following is to be written in JavaThe following is the BSTree.pdfThe following is to be written in JavaThe following is the BSTree.pdf
The following is to be written in JavaThe following is the BSTree.pdf
eyewatchsystems
 
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
rambagra74
 

Similar to Please finish everything marked TODO- BST-java import java-util-Arra.docx (20)

can you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdfcan you add a delete button and a add button to the below program. j.pdf
can you add a delete button and a add button to the below program. j.pdf
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
 
For this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docxFor this micro assignment, you must implement two Linked List functi.docx
For this micro assignment, you must implement two Linked List functi.docx
 
Favor composition over inheritance
Favor composition over inheritanceFavor composition over inheritance
Favor composition over inheritance
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
Please fix my errors class Iterator public Construc.pdf
Please fix my errors   class Iterator  public  Construc.pdfPlease fix my errors   class Iterator  public  Construc.pdf
Please fix my errors class Iterator public Construc.pdf
 
To-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step GuideTo-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step Guide
 
Data Structures and Agorithm: DS 14 Binary Expression Tree.pptx
Data Structures and Agorithm: DS 14 Binary Expression Tree.pptxData Structures and Agorithm: DS 14 Binary Expression Tree.pptx
Data Structures and Agorithm: DS 14 Binary Expression Tree.pptx
 
2014-11-01 01 Денис Нелюбин. О сортах кофе
2014-11-01 01 Денис Нелюбин. О сортах кофе2014-11-01 01 Денис Нелюбин. О сортах кофе
2014-11-01 01 Денис Нелюбин. О сортах кофе
 
The following is to be written in JavaThe following is the BSTree.pdf
The following is to be written in JavaThe following is the BSTree.pdfThe following is to be written in JavaThe following is the BSTree.pdf
The following is to be written in JavaThe following is the BSTree.pdf
 
Lab3
Lab3Lab3
Lab3
 
6. Generics. Collections. Streams
6. Generics. Collections. Streams6. Generics. Collections. Streams
6. Generics. Collections. Streams
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
 
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
Zend Framework and the Doctrine2 MongoDB ODM (ZF1)
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
 
Reactive clean architecture
Reactive clean architectureReactive clean architecture
Reactive clean architecture
 
C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)C++ prgms 5th unit (inheritance ii)
C++ prgms 5th unit (inheritance ii)
 
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
5. Design and implement a method contains 2 for BinarySearchTree, fu.pdf
 
Awt
AwtAwt
Awt
 

More from JakeT2gGrayp

Please answer all questions- Will upvote! Profitability ratios help in.docx
Please answer all questions- Will upvote! Profitability ratios help in.docxPlease answer all questions- Will upvote! Profitability ratios help in.docx
Please answer all questions- Will upvote! Profitability ratios help in.docx
JakeT2gGrayp
 
Please answer all questions- 1) Adaptive immunity has five distinct a.docx
Please answer all questions-  1) Adaptive immunity has five distinct a.docxPlease answer all questions-  1) Adaptive immunity has five distinct a.docx
Please answer all questions- 1) Adaptive immunity has five distinct a.docx
JakeT2gGrayp
 
Please answer all questions- IMMUNIZATION Immunization or vaccination.docx
Please answer all questions-  IMMUNIZATION Immunization or vaccination.docxPlease answer all questions-  IMMUNIZATION Immunization or vaccination.docx
Please answer all questions- IMMUNIZATION Immunization or vaccination.docx
JakeT2gGrayp
 
Please answer all questions- b- The in which CD95L binds to CD95 on t.docx
Please answer all questions-  b- The in which CD95L binds to CD95 on t.docxPlease answer all questions-  b- The in which CD95L binds to CD95 on t.docx
Please answer all questions- b- The in which CD95L binds to CD95 on t.docx
JakeT2gGrayp
 
Please answer all questions- T Lymphocytes (T Cells) 1) T lymphocytes.docx
Please answer all questions-  T Lymphocytes (T Cells) 1) T lymphocytes.docxPlease answer all questions-  T Lymphocytes (T Cells) 1) T lymphocytes.docx
Please answer all questions- T Lymphocytes (T Cells) 1) T lymphocytes.docx
JakeT2gGrayp
 
Please answer all questions- 10- Antibody Function- The binding of an.docx
Please answer all questions-  10- Antibody Function- The binding of an.docxPlease answer all questions-  10- Antibody Function- The binding of an.docx
Please answer all questions- 10- Antibody Function- The binding of an.docx
JakeT2gGrayp
 
Please make revision to the following program so it incorporates three.docx
Please make revision to the following program so it incorporates three.docxPlease make revision to the following program so it incorporates three.docx
Please make revision to the following program so it incorporates three.docx
JakeT2gGrayp
 

More from JakeT2gGrayp (20)

Please discuss the bone growth abnormality achondroplasia (achondropla.docx
Please discuss the bone growth abnormality achondroplasia (achondropla.docxPlease discuss the bone growth abnormality achondroplasia (achondropla.docx
Please discuss the bone growth abnormality achondroplasia (achondropla.docx
 
Please answer all questions- Will upvote! Profitability ratios help in.docx
Please answer all questions- Will upvote! Profitability ratios help in.docxPlease answer all questions- Will upvote! Profitability ratios help in.docx
Please answer all questions- Will upvote! Profitability ratios help in.docx
 
picture of artery and vein to label i need a plain diagram of arteries.docx
picture of artery and vein to label i need a plain diagram of arteries.docxpicture of artery and vein to label i need a plain diagram of arteries.docx
picture of artery and vein to label i need a plain diagram of arteries.docx
 
Please answer all questions- 1) Adaptive immunity has five distinct a.docx
Please answer all questions-  1) Adaptive immunity has five distinct a.docxPlease answer all questions-  1) Adaptive immunity has five distinct a.docx
Please answer all questions- 1) Adaptive immunity has five distinct a.docx
 
Photoreceptors respond to the removal of light by Group of answer choi.docx
Photoreceptors respond to the removal of light by Group of answer choi.docxPhotoreceptors respond to the removal of light by Group of answer choi.docx
Photoreceptors respond to the removal of light by Group of answer choi.docx
 
Please answer all questions- IMMUNIZATION Immunization or vaccination.docx
Please answer all questions-  IMMUNIZATION Immunization or vaccination.docxPlease answer all questions-  IMMUNIZATION Immunization or vaccination.docx
Please answer all questions- IMMUNIZATION Immunization or vaccination.docx
 
Place these phases of an audit in chronological order- A- Assess the r.docx
Place these phases of an audit in chronological order- A- Assess the r.docxPlace these phases of an audit in chronological order- A- Assess the r.docx
Place these phases of an audit in chronological order- A- Assess the r.docx
 
Petty Cash Fund Petty Cash Fund Libby Company established a petty cas.docx
Petty Cash Fund  Petty Cash Fund Libby Company established a petty cas.docxPetty Cash Fund  Petty Cash Fund Libby Company established a petty cas.docx
Petty Cash Fund Petty Cash Fund Libby Company established a petty cas.docx
 
Please answer question 4b only 4- The image below (on Endomembrane Sys.docx
Please answer question 4b only 4- The image below (on Endomembrane Sys.docxPlease answer question 4b only 4- The image below (on Endomembrane Sys.docx
Please answer question 4b only 4- The image below (on Endomembrane Sys.docx
 
Please answer all questions- b- The in which CD95L binds to CD95 on t.docx
Please answer all questions-  b- The in which CD95L binds to CD95 on t.docxPlease answer all questions-  b- The in which CD95L binds to CD95 on t.docx
Please answer all questions- b- The in which CD95L binds to CD95 on t.docx
 
Please answer all questions- T Lymphocytes (T Cells) 1) T lymphocytes.docx
Please answer all questions-  T Lymphocytes (T Cells) 1) T lymphocytes.docxPlease answer all questions-  T Lymphocytes (T Cells) 1) T lymphocytes.docx
Please answer all questions- T Lymphocytes (T Cells) 1) T lymphocytes.docx
 
Please answer all questions- 5- When the inflammatory mediators excee (1).docx
Please answer all questions-  5- When the inflammatory mediators excee (1).docxPlease answer all questions-  5- When the inflammatory mediators excee (1).docx
Please answer all questions- 5- When the inflammatory mediators excee (1).docx
 
Please answer all questions- 10- Antibody Function- The binding of an.docx
Please answer all questions-  10- Antibody Function- The binding of an.docxPlease answer all questions-  10- Antibody Function- The binding of an.docx
Please answer all questions- 10- Antibody Function- The binding of an.docx
 
Phosphatidate is an intermediate in the formation of- a) phospholipids.docx
Phosphatidate is an intermediate in the formation of- a) phospholipids.docxPhosphatidate is an intermediate in the formation of- a) phospholipids.docx
Phosphatidate is an intermediate in the formation of- a) phospholipids.docx
 
phage type of 42D- Which statement(s) are true- Check All That Apply T.docx
phage type of 42D- Which statement(s) are true- Check All That Apply T.docxphage type of 42D- Which statement(s) are true- Check All That Apply T.docx
phage type of 42D- Which statement(s) are true- Check All That Apply T.docx
 
Pequired informetion Learning Objective 03-P6- Prepare closing entries.docx
Pequired informetion Learning Objective 03-P6- Prepare closing entries.docxPequired informetion Learning Objective 03-P6- Prepare closing entries.docx
Pequired informetion Learning Objective 03-P6- Prepare closing entries.docx
 
Please update the registers at the end of the program execution- Also.docx
Please update the registers at the end of the program execution- Also.docxPlease update the registers at the end of the program execution- Also.docx
Please update the registers at the end of the program execution- Also.docx
 
Please see below H10 table released by the Fed- Rates in currency unit.docx
Please see below H10 table released by the Fed- Rates in currency unit.docxPlease see below H10 table released by the Fed- Rates in currency unit.docx
Please see below H10 table released by the Fed- Rates in currency unit.docx
 
People are perceived as being more trustworthy when they- Select one-.docx
People are perceived as being more trustworthy when they- Select one-.docxPeople are perceived as being more trustworthy when they- Select one-.docx
People are perceived as being more trustworthy when they- Select one-.docx
 
Please make revision to the following program so it incorporates three.docx
Please make revision to the following program so it incorporates three.docxPlease make revision to the following program so it incorporates three.docx
Please make revision to the following program so it incorporates three.docx
 

Recently uploaded

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 

Please finish everything marked TODO- BST-java import java-util-Arra.docx

  • 1. Please finish everything marked TODO. BST.java import java.util.ArrayList; import java.util.Collection; import java.util.List; public class BST<E extends Comparable<E>> implements Tree<E> { private int height; private int size; private BinaryNode<E> root; public BST(){ this.root = null; this.height = 0; this.size = 0; } // TODO: BST public BST(BinaryNode<E> root){ } // Access field public BinaryNode<E> root() { return this.root; } // Basic properties public int height() { return this.height; } public int size() { return this.size; } public boolean isBalanced() { return root.isBalanced(); } // TODO: updateHeight - Update the root height to reflect any changes public void updateHeight() { } // Traversals that return lists // TODO: Preorder traversal
  • 2. public List<E> preOrderList() { return new ArrayList<>(); } // TODO: Inorder traversal public List<E> inOrderList() { return new ArrayList<>(); } // TODO: Postorder traversal public List<E> postOrderList() { return new ArrayList<>(); } // Helpers for BST/AVL methods // TODO: extractRightMost // This will be called on the left subtree and will get the maximum value. public BinaryNode<E> extractRightMost(BinaryNode<E> curNode) { return null; } // AVL & BST Search & insert same // TODO: search public BinaryNode<E> search(E elem) { return null; } // TODO: insert public void insert(E elem) { } // TODO: delete public BinaryNode<E> delete(E elem) { return null; } // Stuff to help you debug if you want // Can ignore or use to see if it works. static <E extends Comparable<E>> Tree<E> mkBST (Collection<E> elems) { Tree<E> result = new BST<>(); for (E e : elems) result.insert(e); return result; } public TreePrinter.PrintableNode getLeft() { return this.root.hasLeft() ? this.root.left() : null;
  • 3. } public TreePrinter.PrintableNode getRight() { return this.root.hasRight() ? this.root.right() : null; } public String getText() { return (this.root != null) ? this.root.getText() : ""; } }