Classical

Data Structures - Sorting & Searching

1:  

The time complexity of linear search algorithm over an array of n elements is

A.

O (log2 n)

B.

O(n)

C.

O(n log2 n)

D.

0 (n2)

 
 

Option: B

Explanation :

Linear search  has linear-time complexity; binary search has log-time complexity. 
Here is a table that provides some intuition about the running speeds of algorithms 
 Logarithmic: Linear: 
array size   |        N     
--------------------------------------------------------
        8    |           8       
      128    |        128  
      256    |       256    
     1000    |        1000 
   100,000   |      100,000   ....
Binary search and other divide-and-conquer algorithms have logN time complexity; we say  O(logN) 
Linear search  have linear time complexity: O(N). So the option is 'B'


2:  

The time required to search an element in a linked list of length n is

A.

O(log2 n)

B.

 O(n)

C.

O(1)

D.

0 (n2)

 
 

Option: B

Explanation :


3:  

The worst case time required to search a given element in a sorted linked list of length n is

A.

O(1)

B.

O(log2 n)

C.

O(n)

D.

O(n log2 n)

 
 

Option: C

Explanation :


4:  

Which of the following sorting algorithms does not have a worst case running time of O(n2)?

A. Insertion sort
B. Merge sort
C. Quick sort
D. Bubble sort
 
 

Option: B

Explanation :


5:  

For a linear search in an array of n elements the time complexity for best, worst and average case are ......., ....... and ........ respectively

A.

O(n), O(1), and O(n/2)

B.

O(1), O(n) and O(n/2)

C.

O(1),O(n) and O(n)

D.

O(1), O(n) and (n-1/2)

 
 

Option: C

Explanation :




Suggest an improvement

 


Syllabus covered in this section is-

  • Abstract data types
  • Algorithms
  • Stacks, Queues
  • Linked Lists
  • Trees, Binary search trees
  • Binary heaps

This Section covers Data Structures Questions Answers using C language .
Who can benefit - 

  • Any student who is pursuing B.Sc. in Information Technology can also use this Data Structures mcq section. 
  • Data Structures MCQs can also be used by any student who is pursuing any undergraduate or postgraduate degree in Computer Science.
  • Any candidate who has to appear for DOEACC A, B or C level Exam can also use Data Structures Questions Answers to gain credits in their exams.
  • Candidates appearing for Kendriya Vidyalya Sangathan Entrance Exam can also use Data Structures Multiple Choice Questions Answers for the preparation of their exams.
  • Data Structures Questions Answers can also be used by MCA students for the preparation of their exams.
  • You can also get Data Structures mcq pdf if you purchase an e-book from site.
  • You can download Data Structures MCQ pdf from this site.
  • You can get access to Data Structures Multiple Choice Questions Answers  EBook.

Various Search Terms used for this section are

  • Data Structures quiz questions with answers

  • Data Structures exam questions answers

  • Data Structures MCQ questions Answers

  • Data Structures MCQ

  • Data Structure MCQ Pdf Download