(a)
To prove the characteristics of the recurrence relation is
(a)
Explanation of Solution
Consider the vEB-tree having different subtree of same kinds. Suppose that a vEB-tree consists of different subtrees of size
The nodes of different subtrees need to be stored that takes total space of
The total length of the tree can be defined as the summation of all the vEB-trees that is
Suppose that
Hence, the recurrence relation is defined as
(b)
To prove the recurrence relation
(b)
Explanation of Solution
Suppose the equation
Consider the bound region of the number that fall down to square of 2 that is the ith term of the expression is represented as the summation of all the terms before the ith terms and given as
Consider the unity case so that the value of
Therefore, the recurrence
(c)
To modify vEB-TREE-INSERT to produces pseudo-code for RS-eVB-TREE-INSERT procedures.
(c)
Explanation of Solution
The
Consider the simple procedure of the vEB-TREE-INSERT, the algorithm required some modification to use in the insertion of RS-vEB-TREE-INSERT. The modifications are given below:
- The algorithm needs to checks the key that have to insert in the tree already exists or not in the cluster.
- If the key is already existed in the cluster then it just replaces the key with desired key.
- Otherwise it needs to find the position to insert the key that restrict the algorithm procedure.
These modifications mentioned above in the procedure of vEB-TREE-INSERT make the procedure as the procedure of RS-vEB-TREE-INSERT.
(d)
To modifies the vEB-TREE-SUCESSOR procedure to produce code for the procedure RS-eVB-TREE-SUCESSOR.
(d)
Explanation of Solution
The procedure can be modifies as follows:
Step 1: Check for the existing key.
Step 2: Allocate the space for non-existing key for successor.
Step 3: Check the key constraints and marked as the successor.
Step 4: If another successor is found then marked the nearest successor to successor of the key.
Now, the algorithm restricts the tree to find the successor of desired key.
(e)
To prove the RS-vEB-TREE-INSERT and RS-vEB-TREE-SUCESSOR procedures run in
(e)
Explanation of Solution
The RS-vEB-TREE-INSERT algorithm is used to insert the key in the tree. The insertion operation first checks the existence of the key in the cluster that needs searching operation.
It dividing the cluster into several new clusters to easily search for the key then if founds then it replace it otherwise it insert the key in to the cluster. The whole procedure is taken the logarithm time and depends upon the size of the tree.
The RS-vEB-TREE-SUCESSOR algorithm finds the successor of the elements by comparing the values of the key to all the keys of the cluster. Suppose that there are total n clusters then the size of the tree is
Therefore, both the procedure takes total time of
(f)
To prove that the space required for the RS-vEB tree structure is
(f)
Explanation of Solution
The general space required to store the RS-vEB tree is
The adding of elements in the corresponding hash table of the tree requires the constant time as the position is marked as the fundamental source for storing the keys in the table.
If a new element is inserted in the table then it also stores in the summary of RS-vEB tree and the tree is already existed, it just required to add that will takes the constant amortized of time equals to the number of elements in the cluster of tree.
After adding the key it required to make one element as the min-elements where it adds the elements and the min-element is already defined to it takes the constant time that is equal to the
To give the time required to create RS-vEB trees.
Explanation of Solution
The algorithm of RS-vEB-TREE-INSERT is used to create a tree by using the elements with some parameters. For the creation of the tree the algorithm initialized a parameter that is
The algorithm depends on the parameter u for the insertion of elements but for the creation of empty RS-vEB tree it just initialized the
The initialization of the
Want to see more full solutions like this?
- Computer Science Exercise: shape [★★★] Write a function same_shape : 'a tree -> 'b tree -> bool that determines whether two trees have the same shape, regardless of whether the values they carry at each node are the same. Hint: use a pattern match with three branches, where the expression being matched is a pair of trees. please use Ocaml for the codingarrow_forwardCreate a binary linked tree, and traverse the tree by using the recursive function. The structure of the tree is as follow: You should input the nodes in pre-order sequence. If a child of a node is NULL, input a space. Write the function of create binary tree, pre-order to print the nodes, in-order to print the nodes and post-order to print the nodes. Count the height of the tree. Header file typedef char ElemType; typedef struct node//define the type of binary tree node { }BTnode; Source file #include <stdio.h> #include <stdlib.h> #include "tree.h" BTnode * createTree()//create the binary tree,return the root { BTnode *tnode;// tnode is the root char elem; ;//input the character //if the input is a space,set the pointer as NULL Else// if the input is not a space,generate the binary node and create its left sub-tree and right…arrow_forward12. How many recursive calls needed to build this perfect binary tree? Please show the detailed step by step calculation from the following recursive definition in the box. Base Case: If a single node has no children, it is a perfect binary tree of height h = 0 If a node has h> 0, it is a perfect binary tree if both of its subtrees are of height h- 1 and are non-overlapping or in other words- "If T is a perfect binary tree, then a new perfect binary tree T' can be constructed by taking two copies of T, adding a new vertex y and adding edges between v and the roots of each copy of T. The new vertex v is the root of T" 1. 2.arrow_forward
- All of the following are true EXCEPT: An empty tree is defined to have a height of 1. The depth of a node p is the number of ancestors of p, other than p itself. The height of a tree to be equal to the maximum of the depths of its nodes (or zero, if the tree is empty). The height of a node p in a tree T: • If p is a leaf, then the height of p is 0. • Otherwise, the height of p is one more than the maximum of the heights of p's children.arrow_forwardThe following key values are inserted into a B+ - tree in which order of the internal nodes is 3, and that of the leaf nodes is 2, in the sequence given below. The order of internal nodes is the maximum number of tree pointers in each node, and the order of leaf nodes is the maximum number of data items that can be stored in it. The B+-tree is initially empty.arrow_forwardDevelop a pseudo-code algorithm for a level-order traversal of a binary tree. Create an array-based implementation (write a program) of a binary tree using the computational strategy. Include the following methods: a. Remove a node from the binary tree. b. Insert a node into the binary tree. c. Remove the minimum (smallest) element from the treearrow_forward
- Hippity hoppity, abolish loopity def frog_collision_time(frog1, frog2): A frog hopping along on the infinite two-dimensional lattice grid of integers is represented as a 4- tuple of the form (sx, sy, dx, dy) where (sx, sy) is its starting position at time zero, and (dx, dy) is its constant direction vector for each hop. Time advances in discrete integer steps 0, 1, 2, 3, ... so that each frog makes one hop at every tick of the clock. At time t, the position of that frog is given by the formula (sx+t*dx, sy+t*dy) that can be nimbly evaluated for any t. Given two frogs frog1 and frog2 that are guaranteed to initially stand on different squares, return the time when both frogs hop into the same square. If these two frogs never simultaneously arrive at the same square, return None. This function should not contain any loops whatsoever. The result should be calculated using conditional statements and integer arithmetic. Perhaps the best way to get cracking is to first solve a simpler…arrow_forwardHippity hoppity, abolish loopity def frog_collision_time(frog1, frog2): A frog hopping along on the infinite two-dimensional lattice grid of integers is represented as a 4-tuple of the form (sx, sy, dx, dy) where (sx, sy) is its starting position at time zero, and (dx, dy) is its constant direction vector for each hop. Time advances in discrete integer steps 0, 1, 2, 3, ... so that each frog makes one hop at every tick of the clock. At time t, the position of that frog is given by the formula (sx+t*dx, sy+t*dy) that can be nimbly evaluated for any t.Given two frogs frog1 and frog2 that are guaranteed to initially stand on different squares, return the time when both frogs hop into the same square. If these two frogs never simultaneously arrive at the same square, return None.This function should not contain any loops whatsoever. The result should be calculated using conditional statements and integer arithmetic. Perhaps the best way to get cracking is to first solve a simpler version…arrow_forwardCreate a binary linked tree, and traverse the tree by using the recursive function. The structure of the tree is as follow: //PICTURE// You should input the nodes in pre-order sequence. If a child of a node is NULL, input a space. Write the function of create binary tree, pre-order to print the nodes, in-order to print the nodes and post-order to print the nodes. Count the height of the tree.arrow_forward
- Consider the following array representation of a complete binary tree in python. A B C D E F G H I J K L M N O Perform following operations on the tree. Find left child and right child of each parent in the tree Find sibling of each node in the tree Find parent of each node in the treearrow_forwardThe definition for binary search tree should be the one used in class Class definition: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n ♯ ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ● bst_insert must be iterative (NOT recursive). ● bst_remove and bst_remove_max must use the algorithm described by the suggested book authors In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max. ● In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_ma #ifndef BT_NODE_H#define BT_NODE_H struct btNode{ int data; btNode* left; btNode* right;};// pre: bst_root is root pointer of a…arrow_forwardThe definition for binary search tree should be the one used in class Class definition: A BST is a binary tree that (if not empty) also follows two storage rules regarding its nodes’ items: ♯ For any node n of the tree, every item in n’s left subtree (LST), if not empty, is less than the item in n ♯ ♯ For any node n of the tree, every item in n’s right subtree (RST), if not empty, is greater than the item in n ● bst_insert must be iterative (NOT recursive). ● bst_remove and bst_remove_max must use the algorithm described by the suggested book authors In btNode.h: provide prototypes for bst_insert, bst_remove and bst_remove_max. ● In btNode.cpp: provide definition (implementation) for bst_insert, bst_remove and bst_remove_ma ► Do make gogo (after successful compilation or re-compilation) to test with result (excluding progress-logging messages) output to…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education