Data Structures - Sorting & Searching

11:  

To sort many large object or structures, it would be most efficient to

A.

Place reference to them in and array an sort the array

B.

Place them in a linked list and sort the linked list

C.

Place pointers to them in an array and sort the array

D.

Place them in an array and sort the array

 
 

Option: B

Explanation :

  • Dynamic structure (Memory Allocated at run-time).
  • We can have more than one datatype.
  • Re-arrange of linked list is easy (Insertion-Deletion).
  • It doesn’t waste memory.

So, the answer is 'B'

 

Click on Discuss to view users comments.

Write your comments here:



12:  

A matrix "a" is called lower triangular if and only if for all j > ai j = 0. If such a matrix is to be sorted in a one dimensional array, A then ai j could be mapped to which of the following index of A ?

A.

1/2 * i (i + 1) j 

B.

i + j

C.

i (i + 1) + j

D.

none of these

 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:



13:  

Average successful search time for sequential search on 'n' items is

A.

n/2

B.

(n-1)/2

C.

(n+1)/2

D.

None of these

 
 

Option: C

Explanation :

 

If search key matches the very first item, with one comparison we can terminate. If it is second, two comparisons, etc.
Average =[ n (n + 1) ] / 2

Click on Discuss to view users comments.

Write your comments here:



14:  

 The average search time of hashing, with linear probing will be less if the load factor

A.

Is far less than one

B.

equals one

C.

is far greater than one

D.

none of these

 
 

Option: A

Explanation :

Load factor is the ratio of number of records that are currently present and the total number of records that can be present. If the load factor is less, free space will be more. This means probability of collision is less. So, search time will be less. 

Click on Discuss to view users comments.

Write your comments here:



15:  

 Suppose DATA array contains 1000000 elements. Using the binary search algorithm, one requires only about n comparisons to find the location of an item in the DATA array, then n is

A.

60

B.

45

C.

20

D.

None of these

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here: