Answers:
QUESTION1 :TRUE
QUESTION 2: FALSE
QUESTION 3: FALSE
QUESTION 4: TRUE
QUESTION 5: A
QUESTION 6: A
QUESTION 7: A
QUESTION 8: A
QUESTION 9: TRUE
QUESTION 10: False
Question 1:
Modern software systems are blurring the distinction between local files and web pages, which may be stored on a remote computer, so the amount of data that we might wish to search is virtually unlimited. Remarkably, the methods that we shall study can support search and insert operations on symbol tables containing trillions of items or more using only four or five references to small blocks of data. - TRUE
Question 2:
Data storage mechanisms vary widely and continue to evolve, so we use a simple model to capture the essentials. We use the term probe to refer to a contiguous block of data and the term page to refer to the first access to a probe. - FALSE
Question 3:
We avoid making specific assumptions about the page size and about the ratio of the time required for a probe to the time required, subsequently, to access items within the block. In typical situations, these values are likely to be on the order of 100 or 1,000 or 10,000; we do not need to be more precise because the algorithms are not highly sensitive to differences in the values in the ranges of interest. - FALSE
Question 4:
In the B-tree cost model, when studying algorithms for external searching, we count page accesses, the number of times a page is accessed (for reads, not writes). - TRUE
Question 5:
B-trees extend the 2-3 tree data structure with a crucial difference which enables us to more easily separate the index from the table itself, much like the index in a book:
A. rather than store the data in the tree, we build a tree with copies of the keys, each key copy associated with a link.
B. rather than store the data in the link, we build a tree with copies of the keys, each key copy associated with a tree.
C. rather than store the data in the keys, we build a tree with copies of the tree, each key copy associated with a link.
D. rather than store the data in the tree, we build a tree with a link, each key copy associated with copies of the keys.
Question 6:
Multiway balanced search trees with a fixed page size specify the value of M by using the terminology "B-tree of order M."
A. In a B-tree of order 4, each node has at most 3 and at least 2 key- link pairs in a B-tree of order 6, each node has at most 5 and at least 3 link pairs (except possibly the root, which could have 2 key-link pairs), and so forth
B. In a B-tree of order 4, each node has at most 5 and at least 3 link pairs (except possibly the root, which could have 2 key-link pairs), and so forth in a B-tree of order 6, each node has at most 3 and at least 2 key- link pairs
C. In a B-tree of order 4, each node has at most 4 and at least 4 key- link pairs in a B-tree of order 6, each node has at most 6 and at least 6 link pairs (except possibly the root, which could have 2 key-link pairs), and so forth
D. In a B-tree of order 4, each node has at most 2 and at least 1 key- link pairs in a B-tree of order 6, each node has at most 2 and at least 1 link pairs (except possibly the root, which could have 2 key-link pairs), and so forth
Question 7:
B-trees, as with 2-3 trees, we enforce upper and lower bounds on the number of key-link pairs that can be in each node, we choose a parameter M (an even number, by convention) and build multiway trees where A. every node must have at most M - 1 key-link pairs and at least M/2 key-link pairs except possibly the root, which can have fewer than M/2 key-link pairs but must have at least 2
B. every node must have at least M - 1 key-link pairs and at most M/2 key-link pairs except possibly the root, which can have fewer than M/2 key-link pairs but must have at least 2
C. every node can have fewer than M/2 key-link pairs but must have at least 2 except possibly the root, which must have at most M - 1 key-link pairs and at least M/2 key-link pairs
D. every node must have at most M - 1 key-link pairs and at least M/2 key-link pairs except possibly the root, which can have fewer than 2 but must have at least M/2 key-link pairs
Question 8:
B-trees use two different kinds of nodes:
A. Internal nodes, which associate copies of keys with pages External nodes, which have references to the actual data
B. Internal nodes, which have references to the actual data External nodes, which associate copies of keys with pages
c. Internal nodes, which associate copies of keys with actual data External nodes, which have references to the pages
D. Internal nodes, which have references of keys with pages External nodes, which associate copies to the actual data
Question 9:
A search or an insertion in a B-tree of order M with n items requires between logM N and logM/2 N probes -a constant number, for practical purposes. - TRUE
Question 10:
The space usage of B-trees is also of interest in practical applications. By construction, the pages are at least half full, 30, in the worst case, B-trees use about half the space that is absolutely necessary for keys, plus extra space for links. - FALSE
Are my answers correct? Question 1 (Mandatory) (1 point) Saved Modern software systems are blurring the...
just need to answer the second question 3 AVL Trees Assume the following notation/operations on AVL trees. An empty AVL tree is denoted E. A non-empty AVL tree T has three attributes: . The key T.key is the root node's key. The left child T.left is T's left subtree, which is an AVL tree (possibly E). The right child T.right is T's right subtree, which is an AVL tree (possibly E) [3 marks] Describe an alternative version of the RANGECOUNT(T,...
Using Python to solve the question def _put(self,key,val,currentNode): if key < currentNode.key: if currentNode.hasLeftChild(): self._put(key,val,currentNode.leftChild) else: currentNode.leftChild = TreeNode(key,val,parent=currentNode) elif key > currentNode.key: if currentNode.hasRightChild(): self._put(key,val,currentNode.rightChild) else: currentNode.rightChild = TreeNode(key,val,parent=currentNode) Problem 5 Binary Search Trees (30 points) Modify the books implementation of the binary search tree described in chapters 6.10-6.13 so that it handles duplicate keys properly. The BinarySearchTree class implements a binary search tree where every node of the tree contains a key and a corresponding data item (the...
Assume the following notation/operations on AVL trees. An empty AVL tree is denoted E. A non-empty AVL tree T has three attributes The key T.key is the root node's key. The left child T.left is Ts left subtree, which is an AVL tree (possibly E). The right child T.right is T's right subtree, which is an AVL tree (possibly E). (a) 5 marsl Write a function RANGECOUNT(T, lo, hi) to count the number of nodes in an AVL tree with...
Assume the following notation/operations on AVL trees. An empty AVL tree is denoted E. A non-empty AVL tree T has three attributes: • The key T.key is the root node’s key. • The left child T.left is T’s left subtree, which is an AVL tree (possibly E). • The right child T.right is T’s right subtree, which is an AVL tree (possibly E). (a) [5 marks] Write a function RangeCount(T, lo, hi) to count the number of nodes in an...
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...
QUESTION 1 In a tree, a ____ is a node with successor nodes. root child descendent parent sibling QUESTION 2 In a tree, the ____ is a measure of the distance from a node to the root. count degree branch height level QUESTION 3 Which of the following is not a characteristic of a binary search tree? Each node has zero, one, or two successors. The preorder traversal processes the node first, then the left subtree, and then the right...
Data Structures and Algorithms What is the: a. maximum number of levels that a binary search tree with 100 nodes can have? b. minimum number of levels that a binary search tree with 100 nodes can have? c. maximum total number of nodes in a binary tree that has N levels? (Remember that the root is level 0.) d. maximum number of nodes in the Nth level of a binary tree? e. number of ancestors of a node in 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...
using java to write,show me the output. please write some common. You CAN NOT use inbuild functions for Tree ADT operations. using code below to finsih public class Main { public static void main(String[] args) { BinaryTree tree = new BinaryTree(); tree.root = new Node(1); tree.root.left = new Node(2); tree.root.right = new Node(3); tree.root.left.left = new Node(4); tree.root.left.right = new Node(5); tree.root.right.left = new Node(6); tree.root.right.right = new Node(7); tree.root.left.left.left = new Node(8); tree.root.left.left .right= new Node(9);...
C++ Binary Search Tree question. I heed help with the level 2 question please, as level 1 is already completed. I will rate the answer a 100% thumbs up. I really appreciate the help!. Thank you! searching.cpp #include <getopt.h> #include <iostream> #include <sstream> #include <stdlib.h> #include <unistd.h> using namespace std; // global variable for tree operations // use to control tree maintenance operations enum Mode { simple, randomised, avl } mode; // tree type // returns size of tree //...