1. Fill in the blank: A binary search is faster than a sequential search for ___
ID: 3547124 • Letter: 1
Question
1. Fill in the blank: A binary search is faster than a sequential search for ______ lists.
2. Short Answer: Explain how a sequential search works in 1 or 2 sentences.
3. True or False: On average, a sequential search algorithm searches the entire list.
4. What is the primary advantage of using open hashing/chaining?
5. Hash tables are stored in a/an
a. Linked list
b. Array
c. User-defined ADT
d. Derived class
6. When two objects have the same address in the hash table, there is a ____________. If the number of elements assigned to a certain address goes over the allotted bucket size, an _____________ occurs.
7. What are the main objectives of a hash function?
8. Consider the following code:
void putElementIntoHashTable(int parValue, int parKey){
if (this->key == parKey){
//call the collision case function
collisionCase();
}
else{
//some code here to put the element into the hash table
}
}
For the answer to this question, describe a logical method for collisionCase() with written pseudocode:
9. Which of the following effectively describes a hash table?
a. An array-like structure whose indexes are keys associated with values; these keys and values are contained in a class.
b. A stack-like structure whose indexes are keys associated with values; these keys and values are contained in a class.
c. A structure that is searched via the binary search method.
d. A structure contained in the STL whose indexes are keys associated with values; these keys and values are contained in a class.
e. A structure contained in the STL which is easily searched via keys.
10. Assume you have a set of data. The special member of the data set that uniquely identifies each item of the data set is called______________.
11. Briefly describe what sequential search and binary search are, and compare and contrast the advantages and disadvantages of the two search methods.
12. Suppose you have been requested to design a search algorithm for finding the student whose name is unique---not shared by anyone who has attended Berea College. Assume Alumni Relations has the record sorted based on class (class of 1900, 2016,
Explanation / Answer
1.sorted
2.true
3.true
4.suppose you have a key and a data present in it,to lookup or to insert it is required.ex-suppose you have 10 drawers and some imp files present in it,now to look into some specific data you need to open particular drawer.
5.b
6.collision
7.A hash function is any well-defined procedure or mathematical function which converts a large, possibly variable-sized amount of data into a singular value, usually a single integer that may serve as an index into an array. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes.
8.record pair { value,key }
9.a
10.hash table
11.in sequential search- each element is compared in a unsorted list and a index of the list is returned.it can be applied to an unsorted list.O(n) time complexity.
binary search-it is applied only to a sorted list.it follows divide and conquer technique.it recursively checks the present of an element about the mid postion of an array.it takes O(logn) time complexity.
12.binary search
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.