Doubt on Binary Search

Правка en1, от Lamentis, 2023-08-08 23:03:55

Can someone explain when to use which variation of equality in Binary Search:

1.)while(l<=r) 2.)while(l<r) 3.)while(r-l>1)

Generally, I use the first one as it seems to be the most comfortable for me. However, when going through other participants' codes, I often see the other two variations. Is there any difference?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Lamentis 2023-08-08 23:03:55 348 Initial revision (published)