Question
- B- Practical Exercises Question 1. Write A Java Program To Implement A Binary Search Tree Of Integer Values With The Following Operations: 1) Boolean
- B- Practical Exercises Question 1. Write A Java Program To Implement A Binary Search Tree Of Integer Values With The Following Operations: 1) Boolean IsEmpty() - Return True If A Tree Is Empty, Return False Otherwise. 2) Void Clear() - Clear A Tree. 3) Node Search(Int X) - Search A Node Having Value X. Return A Reference To That Node If Found, Return Null
15)The height of a tree is the maximum number of edges on a path from the root to a leaf node (thus the height of a tree with root only is 0). Write a function that returns the height of a binary tree. 16)The cost of a path in a tree is sum of the keys of the nodes participating in that path. Write a function that returns the cost of the most expensive path from the root to a leaf node. 17)Write a function to determine whether a given binary tree is AVL or not. 18)What value does the following function return when called with each of the binary trees in question 3? int mystery(Node x) { if (x == null) return 0; else return max(mystery(x.left), mystery(x.right)); } 19)Write a function to determine whether a given binary tree is a heap. Question 2. Write a Java program to implement a binary search tree of string values with operations in the above list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started