in Algorithms retagged by
320 views
0 votes
0 votes

https://gateoverflow.in/18752/tifr2010-b-29

IN THIS QUESTION WHY WE CANT NOT APPLY SINGLE BINARY SEARCH ON ENTIRE ARRAY ???

BECAUSE LET WE HAVE ARRAY 1 14 3 12  5 10 7 8 9 6 11 4 13 2 

SUPPOSE WE NEED TO FIND 4

MID =7 AT MID THERE IS ODD NUMBER SO EITHER CHECK TO LEFT OR RIGHT SUPPOSE TO LEFT  IT IS 10 AND WE KNOW EVEN NUMBER ARE ARRANGED IN DESCENDING ORDER SO 4 WILL BE ON RIGHT OF 7 SO SIMILARLY WE CAN DO LIKE THAT.....IOS THIS APPROACH CORRECT??

 

in Algorithms retagged by
by
320 views

1 Answer

1 vote
1 vote
1. Even numbers are not arranged in Descending , question is saying "The numbers in even positions are sorted in descending order"

2. For binary search we need complete array to be  sorted.

1 comment

OK FINE
0
0

Related questions