a)
If minimum degree is large and each node have maximum number of nodes, then the B-tree will have minimum height and almost all the keys are stored in the leaf nodes.
Assume height of the B-tree is h and each node in the B-tree is full. Then the total number of keys in the tree , n= (2t)h+1-1.
The number of keys at the depth h or leaves in the B-tree= [(2t)h+1-1]-[ (2t)h-1]
The ratio between total number of keys and the number of leaves( or percentage of leaves in the total number of keys)
= [(2t)h+1-1]-[ (2t)h-1] / (2t)h+1-1 ≈ 1-1/2t= (2t-1)/2t > 99%
Therefore, almost keys are stored in the leaves.
For suppose , t=100 then (2t-1)/2t =200-1/200=199/200= 0.995 or 99.5%.
Thus, if t=100, 99.5% of keys will be stored in the leaves.
For suppose , t=200 then (2t-1)/2t =400-1/400=399/400= 0.9975 or 99.75%.
Thus, if t=200, 99.75% of keys will be stored in the leaves.
b)

The above modified B-TREE-SEARCH takes a root node and a key k to be searched as input and returns the all occurrences of k in the tree pointed to by x.
a. It is said that in B-trees with realistically large minimum degrees, almost all keys are...
It is said that in B-trees with realistically large minimum degrees, almost all keys are stored in the leaf nodes. Justify this statement mathematically. Numerically demonstrate your mathematical justification with examples of t = 100 and 200.
(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...
package hw3; import java.util.LinkedList; /* *********************************************************************** * A simple BST with int keys and no values * * Complete each function below. * Write each function as a separate recursive definition (do not use more than one helper per function). * Depth of root==0. * Height of leaf==0. * Size of empty tree==0. * Height of empty tree=-1. * * TODO: complete the functions in this file. * DO NOT change the Node class. * DO NOT change the name...
k-d tree Background One generalization of binary trees is the k-d tree, which stores k-dimensional data. Every internal node of a k-d tree indicates the dimension d and the value v in that dimension that it discriminates by. An internal node has exactly two children, containing data that is less-than-or-equal and data that is greater than v in dimension d. For example, if the node distinguishes on dimension 1, value 107, then the left child is for data with y...
Add printRang method to BST.java that, given a low key value, and high key value, print all records in a sorted order whose values fall between the two given keys. (Both low key and high key do not have to be a key on the list). BST.java import java.lang.Comparable; /** Binary Search Tree implementation for Dictionary ADT */ class BST<Key extends Comparable<? super Key>, E> implements Dictionary<Key, E> { private BSTNode<Key,E> root; // Root of the BST int nodecount; //...
1) Extend the Binary Search Tree ADT to include
a public method leafCount that returns the number of leaf nodes in
the tree.
2) Extend the Binary Search Tree ADT to include a
public method singleParent-Count that returns the number of nodes
in the tree that have only one child.
3) The Binary search tree ADT is extended to
include a boolean method similarTrees that receives references to
two binary trees and determines whether the shapes of the trees are...
You will construct a Huffman tree based on the given frequencies of 26 English alphabets in upper case plus the space character. An internal tree node class in HuffmanTree with necessary information is required. • You will not randomly switch left and right children when merger two trees. Instead, you will build a right-heavy tree according to the following strategies to select the right child. (1) The tree that is taller will be the right child, i.e., the height is...
Write a C++ program to validate computer user-ids and passwords. A list of valid ids and passwords (unsorted) is read from a file and stored in a Binary Search Tree (BST) of UserInfo objects. When user-ids and passwords are entered during execution, this BST is searched to determine whether they are legal. Input (file): UserInfo records for valid users Input (keyboard): Ids and passwords of users logging in Output (screen): Messages indicating whether user-ids and passwords are valid, as well...
For this assignment, you will write a program to work with Huffman encoding. Huffman code is an optimal prefix code, which means no code is the prefix of another code. Most of the code is included. You will need to extend the code to complete three additional methods. In particular, code to actually build the Huffman tree is provided. It uses a data file containing the frequency of occurrence of characters. You will write the following three methods in the...
Create a class to represent a term in an algebraic expression. As defined here, a term consists of an integer coefficient and a nonnegative integer exponent. E.g. in the term 4x2, the coefficient is 4 and the exponent 2 in -6x8, the coefficient is -6 and the exponent 8 Your class will have a constructor that creates a Term object with a coefficient and exponent passed as parameters, and accessor methods that return the coefficient and the exponent. Your class...