Data Structures and Algorithms
a) Berch tho manimum mumbr d lavels that a bena ty wilh 100 madis ean have is 99. in drder to monimize th mumbur laels, wr med to minimiz uumbr al modes af each lvrl. Jhe minimum Mumber Aay afoch level can be 1. pareut euo child uodo X-e. eachucc how one aud liks BST would laok omei and the level o level Lovel 99 (e) thiminimum numbur lwels thol a u wilh 10o ods cau hauwe i Searuh in dn to minimiz mbr luels, we have to amoximiz mumbr d medes of each Bwel Nades aj lw cau b aN ho mauimum Mumbur th tu has M lvel, whuh sthe minimum can kawe
The minimiin poorens e. eachuce hos one aud e BST would look omethg eno child liko and th lvel o Level 98 lerl 2 lovel 98 lovel 99. search luels thol a b) Thminimum mbur tu wlh 100 nods can have i lurls, we have to in order to minimiz br nedes of each lwel monimizs mumbr Nos al Lud N cau be 2 he mauimum Mumber W tw hos m lved, whuh sthe minimum can howe hon 2 100 a"- 2 1017"
Hoor (loy to1))6. manimun total mumba of mods that hos N lovrls ina March manimum tool numbr af Acl ina ods of Lwel i should lal mouimum a N lwels s BST henee tolol no. Modes in th 24214242N pring G.P Aum (G.P.: Gyeometi a Phopeni) -) 2-20 (d) man mumum mumbur d wodus n th Nh lavd of tivany,s
Data Structures and Algorithms What is the: a. maximum number of levels that a binary search...
Algorithms and Data Structures Let T be a binary search tree which implements a dictionary. Let v be a node of T, and T_v be the subtree rooted at v. Design a recursive algorithm CountLE(v, k) which, given an input node v and a key k, returns the number of entries in T_v with key at most k.
java data structures and algorithms binary trees part thank you very much Dagger Given a binary tree and a sum, the method has PathSum determines if the tree has a squareroot-to-leaf path such that adding up all the key values along the path equals the given sum. It uses an auxiliary method which takes the squareroot of the given tree to do its job as follows: public boolean hasPathSum(int sum){ return hasPathSum(root, sum); } Given the following tree where the...
QUESTION 9 Consider the following binary search tree: If the root node, 50, is deleted, which node will become the new root? A 15 B 24 C 37 D 62 QUESTION 10 In the following trees EXCEPT______, the left and right subtrees of any node have heights that differ by at most 1. A complete trees B perfect full trees C balanced binary trees D binary search trees QUESTION 11 A perfect full binary tree whose height is 5 has...
Draw the tree resulting from inserting the following values into a binary search tree in order without re-balancing: 40, 10, 60, 30, 20, 90, 70, 50 Null pointers can be omitted as long as it is clear whether a single child is a left or right child. THEN For every node in the tree, the values that can be in the subtree rooted at that node are constrained by ancestors to be in some range of integers. The root (the...
Data structures C++1- A balanced binary tree is a binary tree structure in which the left and right subtrees of every node differ in height by no more than 1 Out of the following choices, which is the minimum set of nodes, if removed, will make the BST balanced?2- Which of the following is true for Red-Black Trees ? Select all choices that apply! Select one or more: a. For each node in the tree, all paths from that node to any leaf nodes contain...
Design a divide-and-conquer algorithm for computing the number of levels in a binary tree. In particular, the algorithm should return 0 and 1 for the empty and single-node trees respectively. Please provide the pseudocode for your algorithm. What is the running time of your algorithm in the worst case using O() notation? Design a divide-and-conquer algorithm for computing the number of levels in a COMPLETE binary tree. In particular, the algorithm should return 0 and 1 for the empty and...
1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree: The letter next to each node (e.g., a, b) denotes the tree node, and the number inside each node is the key. 1.1 Correctness (10 points) Is this binary tree a valid binary search tree? In other words, does it satisfy the binary search tree property? If not, which node(s) violates the binary search tree...
Trees and Heaps 1. Show that the maximum number of nodes in a binary tree of height h is 2h+1 − 1. 2. A full node is a node with two children. Prove that the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree. 3. What is the minimum number of nodes in an AVL tree of height 15? 4. Show the result of inserting 14, 12, 18, 20, 27, 16,...
Trees-related questionsBeginning with an empty binary search tree, what binary search tree is formed when you add the following letters in the order given? J, N, B, A, W, E, TRepresent the following binary tree with an array What is the result of adding 3 and 4 to the 2-3 tree shown below?Why does a node in a red-black tree require less memory than a node in a 2-3-4 tree?Why can’t a Red-Black Tree have a black child node with exactly...
(a) A student believes that Binary Search Trees possess the following property. Suppose we search for a key and the matching node is a leaf node. Let L be the set of all nodes to the left of the search path, P the set of all nodes on the search path, and R be the set of all nodes to the right of the search path. The student claims that any three keys I ∈ L, p ∈ P, and...