Question

In: Computer Science

How can I prove that finding the minimum or maximum of n numbers has a lower...

How can I prove that finding the minimum or maximum of n numbers has a lower bound of Ω(n) for any comparison-based algorithm.

Solutions

Expert Solution

Finding minimum or maximum element of an array requires (n-1) comparisons, we compare each element of the set of numbers in turns and keep track of the minimum or maximum, this requires (n-1) comparisons. We can't do better than (n-1) comparisons as we have to check each number with the minimum or maximum number of the rest of the numbers at least once.

PROOF:

Suppose a set of m elements requires x number of comparisons to find the minimum or maximum. Thus (m-1) numbers require (x-1) comparisons to find the minimum or maximum. By induction we can say that {m-(m-2)}= 2 numbers require {x-(m-2)} comparisons.

we know that x-m+2=1 => x=m-1

Thus the lower bound for finding the minimum or maximum would require m-1 comparisons for m numbers.

CONCLUSION:

Hence we know that for some positive constant C>0 say C=0.5; C*n <= (n-1) for all n >=2. Thus finding the minimum or maximum of n numbers has a lower bound of Ω(n) for any comparison-based algorithm.


Related Solutions

Into how many parts can n circles divide the plane, maximum and minimum?
Into how many parts can n circles divide the plane, maximum and minimum?
For each of the following signed numbers: what are the minimum and maximum values it can...
For each of the following signed numbers: what are the minimum and maximum values it can represent? 3 bit minimum & Maximum 5 bit minimum & Maximum
What are the steps of finding the absolute maximum and absolute minimum?
What are the steps of finding the absolute maximum and absolute minimum?
Give the maximum number of orbitals in an atom that can have these quantum numbers: n...
Give the maximum number of orbitals in an atom that can have these quantum numbers: n = 3                                                   _______________ n = 3, l = 1                                           ______________ n=2, l=1, ml= 0                                    _______________ n=0, l=0, ml=0                                     _______________ Removing the electron from a Hydrogen atom corresponds to a raising the electron from n=1 to an orbit that has n=∞.             What is the energy needed to remove the electron from a hydrogen atom? What is the energy in terms of kJ per...
How can I prove that the number of proper subsets of a set with n elements is 2n−1 ?
How can I prove that the number of proper subsets of a set with n elements is 2n−1 ?
How do I calculate the bin minimum, maximum, and length in Microsoft Excel?
How do I calculate the bin minimum, maximum, and length in Microsoft Excel?
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Consider sorting n numbers stored in array A by first finding the smallest element of A...
Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A and exchange it with A[2]. Continue in this manner for the first n-1 elements of A. a) (10 points) This algorithm is known as the selection sort. Write the pseudo code for this algorithm. b) (10 points) What loop invariant does this algorithm maintain? Note: You do not...
In pumping lemma I know how to prove 0^n 1^n is not regular but what changes...
In pumping lemma I know how to prove 0^n 1^n is not regular but what changes when I have 0^n 1^n 2^n (three variables). Do I need to check 6 variations of 0,1 and 2 instead of only 3 in 0^n 1^n? thanks.
There is no minimum or maximum length expectation for this portion of the assignment. I expect...
There is no minimum or maximum length expectation for this portion of the assignment. I expect you to communicate as concisely as possible, and recognize that this will require different lengths of responses for each individual. 1. What are the major pathophysiologic differences between asthma and COPD? 2. Name two clinical signs and/or symptoms that would differentiate asthma from COPD, and explain why that sign is a differentiating feature. 3. Hayden (2007) mentions that “[inhaled corticosteroids] still form the cornerstone...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT