After Midterm
Given a graph G = (V;E) with positive edge weights, the Bellman-Ford algorithm and Dijkstra's algorithm can produce different shortest-path trees despite always producing the same shortest-path weights.
True
Each hash table array element is called a __________.
bucket
Look at the following method. public static int test2(int x, int y) { if ( x < y) { return -5; } else { return (test2(x - y, y + 5) + 6); } } What is the recursive case for the method?
x >= y
In an AVL tree, when the height of both children of a node are the same, this indicates that the balance factor of this node is ____.
0
Look at the following pseudocode algorithm. algorithm Test14(int x) if (x < 8) return (2 * x) else return (3 * Test14(x - 8) + 8) end Test14 What value is returned for Test14(7)?
14
Look at the following pseudocode algorithm. algorithm Test14(int x) if (x < 8) return (2 * x) else return (3 * Test14(x - 8) + 8) end Test14 What is the depth of Test14(16)?
2
Suppose that a non-leaf node in a B-tree has 41 entries. How many children will this node have?
42
What is the maximum possible number of edges in a directed graph with no self loops having 8 vertices?
56
Which of the following statement(s) is TRUE?
A hash function may give the same hash value for distinct messages. A hash function takes a message of arbitrary length and generates a fixed length code.
Two vertices in a graph are ___________ if there is an edge connecting them.
Adjacent
Suppose that X is a B-tree leaf containing 41 entries and having at least one sibling. Which statement is true?
Any sibling of X is also a leaf.
___________ may provide a better solution both within a B-tree node and for collecting B-tree nodes because they are effective in both primary memory and secondary storage.
Arrays
A graph is connected if and only if the number of vertices in the __________ traversal is the same as the number of vertices in the graph regardless of the starting vertex.
Breadth-first
The __________ method is very effective when dealing with an unknown set of key values.
Division
Dijkstra's algorithm may not terminate if the graph contains negative-weight edges.
False
Each recursive call to a method uses the same local variables and parameters.
False
In a B-tree of order 8, the root node must have at least 4 subtrees.
False
Mathematical problems and formulas should not be expressed recursively.
False
The _____________ method and the mid-square method may also be effectively used with strings by manipulating the binary representations of the characters in the string.
Length Dependent
Each recursive call to a method creates new local variables and __________.
Parameters
The only difference between a depth-first traversal of a graph and a breadth-first traversal is the use of a _________ instead of a queue to manage the traversal.
Stack
A careful trace of recursive processing can provide insight into the way it is used to solve a problem.
True
A find operation on a balanced binary search tree is O(logn) where as a find operation for binary search tree without the balance assumption is O(n).
True
The open addressing method for handling collisions looks for another open position in the table other than the one to which the element is originally hashed.
True
What is the best definition of a collision in a hash table?
Two entries are identical except for their keys
In a height balanced binary search tree (AVL), when do you make an adjustment in the tree?
When the height difference between two sides of a node is greater than or equal to two.
Any recursive definition must have a non-recursive part, called the ___________, which permits the recursion to eventually end.
base case
A binary tree is a collection of nodes in which
each node has at most one predecessor and at most two successors
A technique for direct search is _______________
hashing
The searching technique that takes O (1) time to find a data is _____________.
hashing
Inserting an element into a 2-3-4 tree can have a ripple effect up the tree causing the _______ of the tree to increase.
height
Recursion is a programming technique in which a ________ calls itself.
method
A breadth first traversal of a tree or a graph is commonly implemented with a(n)_______.
queue
A minheap stores its smallest element at the ________ of the binary tree.
root
A node that does not have a parent is called the ______ of a tree.
root
To maintain the completeness of the tree, there is only one valid element to replace the ________, and that is the element stored in the last leaf in the tree.
root
A careful _______ of recursive processing can provide insight into the way it is used to solve a problem.
trace