Quiz: Extension of Structures & Algorithms

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The 2-3 tree is not a binary tree, but instead its shape obeys the following definition (please provide the shape definition):

1. A node contains one or two keys. 2. Every internal node has either two children (if it contains one key) or three children (if it contains two keys). Hence the name. 3. All leaves are at the same level in the tree, so the tree is always height balanced.

What are the two most significant issues that must be addressed if BSTs are to be used for indexing?

1. How to keep the tree balanced. 2. How to arrange the nodes on blocks so as to keep the number of blocks encountered on any path from the root to leaves at a minimum.

Graph traversals must deal with a number of troublesome cases. Our author lists two cases and provides a solution to both. What are the two cases and how are the issues they present addressed?

1. It may not be possible to reach all vertices from the start vertex. 2. The graph may contain cycles, and we must make sure that cycles do not cause the algorithm to go into an infinite loop. Solution: By maintaining a mark bit for each vertex on the graph. At the beginning of the algorithm the mark bit for all vertices is cleared. The mark bit for a vertex is set when the vertex is first visited during the traversal. If a marked vertex is encountered during traversal, it is not visited a second time. This keeps the program from going into an infinite loop when it encounters a cycle. Once the traversal algorithm completes, we can check if all vertices have been processed by checking the mark bit array. If not all vertices are marked, we can continue the traversal from another unmarked vertex.

Search algorithms can be categorized into three general approaches. What are those three general approaches?

1. Sequential and list methods. 2. Direct access by key value (hashing). 3. Tree indexing methods.

What are the shape properties of a B-tree?

1. The root is either a leaf or has at least two children. 2. Each internal node, except for the root, has between m/2 and m children. 3. All leaves are at the same level in the tree, so the tree is always height balanced.

Why does the mid-square hash function work well for numerical values?

Because the mid-square method squares the key value, and then takes the middle r bits of the result, giving a value in the range 0 to 2r-1. This works well because most or all bits of the key value contribute to the result.

Explain how the Least Recently Used (LRU) buffer pool heuristic works.

LRU simply keeps the buffers in a list. Whenever information in a buffer is accessed, this buffer is brought to the front of the list. When new information must be read, the buffer at the back of the list (the one least recently used) is taken and its "old" information is either discarded or written to disk, as appropriate.

When is a single rotation called for in a Splay tree?

Only if a node is a child of the root node.

How does our author define searching?

Searching is a systematic method for locating the record (or records) with key value kj = K.

For Quicksort the function findpivot is critical with respect to performance. What is the "median of three" technique for finding a pivot point? What makes this technique so appealing?

The "median of three" uses as a pivot the middle of three randomly selected values. This is appealing because its cheap to implement and it is highly unlikely to get a bad input.

When are double rotations required to balance AVL trees?

When attempting to balance a tree which has a left subtree, that is right heavy, or, when attempting to balance a tree which has a right subtree, that is left heavy.

In self-ordering lists the idea is to put the values most likely to be searched for near the ___________ of the list.

beginning

Based on our current knowledge of sorting algorithms and the size of the input, we know that the problem of sorting is bounded by ________ and _______.

big Omega(n); big-Oh(n log n)

A collection of buffers is called a _______.

buffer pool

A C++ programmer views a random access file stored on disk as a contiguous series of ______. This is called a _______ file.

bytes, logical

The non-exchange sorting algorithms described in our text describe multiple approaches to using the divide-and-conquer approach; i.e., there are multiple ways to do the dividing: Mergesort divides a list in ________; Quicksort divides a list into _____ values and ________ values; and Radix Sort divides the problem by working on ______ digit of the key at a time.

half; big, small; one

When all leaf nodes are at the same level, we say that a tree is __________ balanced.

height

Prim's algorithm produces a ___________.

minimum-cost spanning tree

A graph with labels associated with its vertices is called a _________ graph.

labeled


संबंधित स्टडी सेट्स

AP Psychology - unit 4: Sensation and Perception

View Set