subject

This is not a programming assignment. Write code or pseudocode Let the BinarySearchTree class be defined as follows: class BinarySearchTree f class Tree ( int element; Tree left, right; Tree (int x, Tree l, Tree r) I element -x; left = 1; right - r; Tree root; // root of binary search tree int size;// number of elements in the BST BinarySearchTree) // constructor root null; size - 0; BinarySearchTree (Tree t, int s)// constructor root t; size s 1. Given a sorted array of integers, write an algorithm to build a height-balanced binary search tree with its elements. Analyze the running time of the algorithm Recursive algorithms can be solved using the Master method. The functions that you need to write are the following. // Build a height-balanced BST from arr[0..arr. length-1] BinarySearchTree arrayToBST(int[] arr) /*To do*/h // Helper function to build a tree from a subarray // Recursive algorithm that builds a tree recursively from the elements of arrlp..r] // Returned tree is balanced, and satisfies the order constraints of a BST Tree arrayToTree (int[ arr, int p, int r) /* To do */ }
2. Given a binary search tree of integers, and an integer x, write the functions floor and ceiling. Hint: If x is not in the tree, the floor and ceiling elements are on the path taken by find(x) // Class to store 2 integers class Pair { int floor, ceiling; Pair ( int f, int c) { floor = f; ceiling = c; } } // Floor: largest element of the BST that is less than or equal to x // Ceiling: smallest element of the BST that is greater than or equal to x Pair floorAndCeiling(BinarySearchTree t, int x) To do */ }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
What are some websites that you can read manga (ex: manga rock)
Answers: 1
You know the right answer?
This is not a programming assignment. Write code or pseudocode Let the BinarySearchTree class be def...
Questions
question
Mathematics, 09.04.2021 15:40
question
Mathematics, 09.04.2021 15:40
question
Mathematics, 09.04.2021 15:40
Questions on the website: 13722359