Multiple Choice #1. What is the worst-case time for serial search finding a sing
ID: 3659769 • Letter: M
Question
Multiple Choice #1. What is the worst-case time for serial search finding a single item in an array? A. Constant time B. Logarithmic time C. Linear time D. Quadratic time #2. What is the worst-case time for binary search finding a single item in an array? A. Constant time B. Logarithmic time C. Linear time D. Quadratic time #3. What additional requirement is placed on an array, so that binary search may be used to locate an entry? A. The array elements must form a heap. B. The array must have at least 2 entries. C. The array must be sorted. D. The array's size must be a power of two. #4. What is the best definition of a collision in a hash table? A. Two entries are identical except for their keys. B. Two entries with different data have the exact same key. C. Two entries with different keys have the same exact hash value. D. Two entries with the exact same key have different hash values. #5. Which guideline is NOT suggested from from empirical or theoretical studies of hash tables: A. Hash table size should be the product of two primes. B. Hash table size should be the upper of a pair of twin primes. C. Hash table size should have the form 4K+3 for some K. D. Hash table size should not be too near a power of two. #6. In an open-address hash table there is a difference between those spots which have never been used and those spots which have previously been used but no longer contain an item. Which function has a better implementation because of this difference? A. insert B. is_present C. remove D. size E. Two or more of the above functions #7. What kind of initialization needs to be done for an open-address hash table? A. None. B. The key at each array location must be initialized. C. The head pointer of each chain must be set to NULL. D. Both B and C must be carried out. #8. What kind of initialization needs to be done for an chained hash table? A. None. B. The key at each array location must be initialized. C. The head pointer of each chain must be set to NULL. D. Both B and C must be carried out. #9. A chained hash table has an array size of 512. What is the maximum number of entries that can be placed in the table? A. 256 B. 511 C. 512 D. 1024 E. There is no maximum. #10. Suppose you place m items in a hash table with an array size of s. What is the correct formula for the load factor? A. s + m B. s - m C. m - s D. m * s E. m / sExplanation / Answer
1)C. Linear time 2)D. Quadratic time 3) D. The array's size must be a power of 2 4)B. Two entries with different data have a same key. 5) B. Hash table size must be upper of a pair of twin primes 6) B. is_present 7)B. The key at each array location must be initialized 8) D. Both B and C must be carried out 9) E. no maximum is there 10)B. s - m
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.