Chapter 18 Review questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

You have 650 table entries in a hash table with size of 1500. What is the load factor?

0.4333

Use modulo arithmetic to determine the index for a key 1234 for a table of 101 entries.

22

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

A collision

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

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 linear link-based implementation of the ADT dictionary supports addition and removal operations more efficiently than an array-based implementation.

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

In the ArrayDictionary class, we must sort the items each time traverse is called.

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

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

Hash function

An entry in an ADT dictionary is sometimes known as a(n) _________________ pair.

Key-value

What are two other names for the ADT dictionary?

Map or table

Consider sorting a group of people based on their zip code. This criteria is known as a(n) ________________.

Search Key

Which of the following is not an ADT dictionary operation?

Sort the entries

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

True

A binary search tree implementation of the ADT dictionary is nonlinear.

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

Because linear implementations are easy to understand conceptually they are appropriate for dictionaries that will only contain a small number of entries.

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

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

With separate chaining, the size of the dictionary is dynamic and can exceed the size of the hash table.

True

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

Unsorted link-based

When is a perfect hash function possible?

When you know all the search keys

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

Name three categories of linear implementations of a dictionary.

any three of: Sorted by search key array based, sorted by search key link based, unsorted array based, unsorted link based

What are two possible things that could be done if a new entry's search key already exists in the dictionary?

any two of: deny the attempt, ignore the attempt, replace the existing entry with the new entry

Name two reasons for studying the linear implementations of an ADT dictionary?

any two of: perspective, efficiency, and motivation

A hash function maps an integer into a(n) _______________________.

array index

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

What happens when the search key of an existing entry in the dictionary is changed?

could make that entry or other dictionary entries impossible to find.

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

deny the attempt

In the header file for the class ArrayDictionary, the text declares which of the following methods as private?

destroyDictionary( )

What are two requirements for a hash function?

easy and fast to compute, place entries evenly throughout the hash table.

Name three major concerns which constitute a good hash function.

function easy and fast to compute, function scatters data evenly throughout hash table, how well does function scatter random data

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

linear probing

What does primary clustering cause?

long probe searches and there a decrease in overall efficiency in the hashing process.

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

re-hashing

What must a sorted linear array-based implementation of the ADT dictionary do during an addition and when removing an entry?

shift the data

The header file for a class of dictionary entries, called Entry, overloaded what two operators?

the equality operator == and the greater than operator >

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

traversal

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

value

When does use of the binary search tree implementation of the ADT dictionary become less efficient?

when the dictionary approaches a linear shape, comparable to a linear link-based implementation

When using linear probing, what must be done when removing a dictionary item so that later hashing and linear probing still work correctly?

when the item is removed, specify the status of the table location as removed (previously occupied, now available)

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.


Conjuntos de estudio relacionados

Section 2: What is LP Associate responsible for?

View Set

Gov 310L Exam 1 Webtext Questions

View Set

HESI 114 Review Question's from Prep U

View Set