1、Multiple Choice
A hash table contains 10 buckets and uses linear probing to resolve collisions.The key values are integers and the hash function used is( Key % 10).If the values 43,165,62,123,142 are inserted in the table, in what location would the key value 142 be inserted?
Linear probing is a method for resolving collisions in hash tables, data structures for maintaining a collection of key-value pairs and looking up the value associated with a given key. When the hash function causes a collision by mapping a new key to a cell of the hash table that is already occupied by another key, linear probing searches the table for the closest following free location and inserts the new key there.
A. 2
B. 3
C. 4
D. 6
2、Multiple Choice
The average time required to perform a successful sequential search for an element in an array A containing n elements is given by
A. (n+1)/2
B. n
C. n(n+1)/2
D.
3、Multiple Choice
For merging two sorted lists of sizes m and n into a sorted list of sizes m+n,the numbers of comparisons required are
A. O(m)
B. O(n)
C. O(m + n)
D. O(logm + logn)
4、Trees Traversal
The postorder and preorder traversal of a binary tree are given below-
postorder :D E B F G C A
preorder: A B D E C F G respectively
The inorder traversal of the binary tree is()Pick one of the choices
A. D B E A F C G
B. E D B G F C A
C. E D B F G C A
D. D E F G B C A
5. Lookup operations
There are several factors that affect the efficiency of lookup operations in a hash table.Which of the following is NOT one of those factors?
A. Number of elements stored in the hash table
B. Size of elements stored in the hash table
C. Number of buckets in the hash table
D. Quality of the hash function
6、Java :Threads
What is the output of the following Java snippet?
public class SampleDemo
implements Runnable {
private
Thread t ;
private String
threadName;
SampleDemo
(String threadName) {
this.threadName
= threadName;
}
public
void run(){
while