Question: Lab2- implementing Binary Search Tree (MyBST) Programming language: Java 1. Write a method E parentOf(E e) that returns the parent of object e. 2. Add
Lab2- implementing Binary Search Tree (MyBST)
Programming language: Java
1. Write a method E parentOf(E e) that returns the parent of object e.
2. Add a method in the BST class to return the number of the leaves as follows: /** Returns the number of leaf nodes */
public int getNumberOfLeaves()
3. A full binary tree is a binary tree with the leaves on the same level. Add a method in the BST class to return true if the tree is a full binary tree. (Hint: The number of nodes in a full binary tree is )
/** Returns true if the tree is a full binary tree */
boolean isFullBST()
4. Add the following new methods in BST .
/** Displays the nodes in a breadth-first traversal */
public void breadthFirstTraversal() /* the elements are displayed by level */
/** Returns the height of this binary tree */
public int height()

Lab3- MyBST
Programming language: Java
1. Write a method pathOf(TreeNode x) to display the path from the root to node x
2. A ternary tree is like a binary tree, except each node may have up to three successors. Write a TNode class that can be used to represent a ternary tree. Define a notion of preorder and postorder traversal for ternary trees, and write methods void postorder() and void preorder() that implements your notion of those traversals.
3. Given the student class with three attributes IdNumber, name and gpa. Given a list of student objects, we want to search efficiently for students by their gpa. Create a binary search tree to store student objects and show in an application the following methods are working correctly: insert, search, inOrder, postOrder,inOrder and delete method.
10 100 10 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
