Array Operations - Section 1 :: Discussion


19.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)
Answer:  Option  B
Explanation:

Since it is a sorted array, we can use binary search to identify the position of the first occurrence of the given integer in (logn) steps. If at all these integer repeats, its appearance has to be continuous because the array is sorted.

Tutorial Link:
Published by:Kiran Manzoor

Comments are not available

Post your comments here:

Optional

Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers