. Comparison Required Using DNC
The number of comparisons required to find maximum and minimum in the given array of n- element using divide and conquer:
ciel(3n/2)
ciel(3n/2)+2
floor(3n/2)
floor(3n/2)-2
Please help me regarding this
. Comparison Required Using DNC
The number of comparisons required to find maximum and minimum in the given array of n- element using divide and conquer:
ciel(3n/2)
ciel(3n/2)+2
floor(3n/2)
floor(3n/2)-2
Please help me regarding this
Hey @Somasree Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer).
Input : 2.5
Output : 3
Input : -2.1
Output : -2
floor(x) : Returns the largest integer that is smaller than or equal to x (i.e : rounds downs the nearest integer).
Input : 2.5
Output : 2
Input : -2.1
Output : -3
1Pick 2 elements(a, b), compare them. (say a > b)
2. Update min by comparing (min, b)
3. Update max by comparing (max, a)
Therefore, we need 3 comparisons for each 2 elements, so total number of required comparisons will be (3n)/2 – 2, because we do not need to update min or max in the very first step.
See this for better insight
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.