An algorithm is made up of 2 modules M1&M2. If order of M1 is f(n) & M2 is g(n) then the order of algorithm is?
A.  max (f(n),g(n)) 
B.  min (f(n),g(n)) 
C.  f(n) + g(n) 
D.  f(n) X g(n) 
Option: B Explanation : Click on Discuss to view users comments. anonymous said: (11:55am on Wednesday 19th February 2014)
If order of M1 if quadratic and M2 is linear, overall order will be quadratic and not linear right? say F(n) = n^2 and g(n) = n, it should be max(n^2, n) = n^2

An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?
A.  At least 2nc comparisons, for some constant c, are needed. 
B.  At most 1.5n2 comparisons are needed. 
C.  At least nlog_{2}n comparisons are needed. 
D.  None of the above. 
Option: B Explanation : Click on Discuss to view users comments. Aparna said: (11:08pm on Thursday 25th June 2015)
what would be the case if n is odd?

The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is
A.  Θ(n) 
B.  Θ(logn) 
C.  Θ(log*n) 
D.  Θ(1) 
Option: B Explanation : Since it is a sorted array, we can use binary search to identify the position of the first occurence of the given integer in (logn) steps. If at all this integer repeats, its appearance has to be continuous because the array is sorted. Click on Discuss to view users comments. Vishal_Gupta said: (9:59pm on Thursday 26th November 2015)
Since array is sorted so only two comparison are enough to know that an integer appears more than n/2 times correct option is D

Syllabus covered in this section is
This Section covers Data Structures Questions Answers using C language .
Who can benefit 
Various Search Terms used for this section are