Exam 2 review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

A dictionary must store and form an association between search key and data value only for a sorted version of the dictionary, not for unsorted.

FALSE

A sorted array-based implementation of the ADT dictionary cannot use a binary search.

FALSE

An ADT dictionary should never allow duplicate search keys.

FALSE

An implementation of the ADT dictionary using a binary search tree is a poor choice for retrieval dominate applications.

FALSE

If the size of a dictionary is small, a linear implementation is inadequate and difficult to understand.

FALSE

It is insufficient for hash functions to operate only on integers.

FALSE

On average, quadratic probing and double hashing require more comparisons than linear probing.

FALSE

Quadratic probing causes no clustering at all.

FALSE

The add method for the template for TreeDictionary presented in the text does not allow for duplicate entries.

FALSE

The getValue(searchKey) method for an ADT dictionary retrieves the specified search key for a given value.

FALSE

The merge sort is more efficient than the heap sort in the worst case

FALSE

In an array-based implementation of a heap, the add operation is ______.

O(log n)

In an array-based implementation of a heap, the remove operation is ______.

O(log n)

The heapsort is ______ in the average case.

O(log n)

The heapsort is ______ in the worst case.

O(n * log n)

A binary search is impractical with a link-based implementation of the ADT dictionary.

TRUE

A linear link-based implementation of the ADT dictionary does not need to shift data for an add or a remove operation.

TRUE

A perfect hash function maps each search key into a unique location of the hash table.

TRUE

According to the text, if the size of a problem is small, the difference in efficiency among possible solutions is likely insignificant.

TRUE

Dictionary traversal is inefficient when using hashing.

TRUE

Digit selection does not distribute entries in the hash table.

TRUE

Double hashing drastically reduces clustering.

TRUE

In a heap, the search keys of the children of a particular node have no relationship to each other.

TRUE

In a maxheap, the root contains a search key greater than or equal to the search key in each of its children.

TRUE

It is important to know both what operations are needed for a given application of an ADT dictionary and how often each operation is required.

TRUE

The binary search tree implementation of the ADT dictionary has a binary search tree as a data member.

TRUE

The client code should not be able to modify an entry's search key once that entry is in the dictionary.

TRUE

The traverse method visits all dictionary entries.

TRUE

To make an intelligent choice among various possible dictionary implementations, you must analyze the efficiency with which each supports the dictionary operations.

TRUE

the heapsort does not require a second array

TRUE

What is it called when a hash function maps two or more search keys into the same integer

a collision

What does the ADT dictionary use to identify its entries?

a search key

In the class ArrayDictionary declared by the text, which of the following methods bears the responsibility for keeping the array items sorted?

add

According to the text, for the ADT dictionary, a sorted array-based implementation will shift data during what two operations?

additions and removals

Since a heap is a complete binary tree, what would be an efficient basis for its implementation?

array based

According to the text, for the ADT dictionary, what implementation should be used when you do not know the maximum size of the dictionary?

binary search tree

What is the implementation of the ADT dictionary which has efficiency O(log n) for addition?

binary search tree

You define a hash table so that each location table[i] is itself an array. This array is referred to as a(n)

bucket

A heap is a ______.

complete binary tree

A semi-heap is a ______.

complete binary tree

What kind of function tells you where a dictionary entry is currently or will be placed if it is new?

hash function

In an array-based implementation of a heap, the parent of the node in items[i] is always stored in ______.

items[(i-1)/2]

When you begin at the hash location and search the dictionary sequentially, this is called what?

linear probing

n an array-based implementation of a heap, the number of array items that must be swapped to transform a semiheap of n nodes into a heap is ______.

log2 (n + 1)

A heap whose root contains the item with the largest search key is called a ______.

maxheap

A heap whose root contains the item with the smallest search key is called a ______.

minheap

The process of enlarging a hash table and computing new hash indices for its contents is called

re-hashing

Which of the following is the better choice when attempting to add a new entry to a dictionary where the search key already exists?

throw an exception

Which of the following dictionary operations has efficiency O(n) no matter what implementation if the ADT dictionary is chosen?

traversal

What is the implementation of the ADT dictionary which has efficiency O(1) for addition?

unsorted link-based

The ADT dictionary is appropriate for problems that must manage data by

value

According to the text, for the ADT dictionary, in which of the following situations would a sorted array-based implementation be appropriate for frequent retrievals?

when you have duplicate search keys


Kaugnay na mga set ng pag-aaral

Chapter 2: Job-Order Costing: Calculating Unit Product Costs SmartBook

View Set

APUSH Period 2 Assessment (1607-1754)

View Set

Unit 8 - Gene Expression & Regulation

View Set

Psychology 101 chap 1-3 Test Study Guide

View Set