binary search

Revision en1, by Hussam_Jdid, 2024-09-22 21:06:14

Can someone explain to me how do we choose ranges when doing BinarySearch i solved a lot of BS problems but to be honest i alwayes try differnt ways until one of them work... by mean whats the diffence between writing while(l<r) and while(l<=r) and while(l+1<r)...etc and when do we set r=mid and when r=mid-1 and same for l , please someone explain them all this is the only thing confuse me at BS problems

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Hussam_Jdid 2024-09-22 21:06:14 421 Initial revision (published)