Calculating mid in binary search

后端 未结 8 1033
暖寄归人
暖寄归人 2020-11-29 17:34

I was reading an algorithms book which had the following algorithm for binary search:

public class BinSearch {
  sta         


        
8条回答
  •  余生分开走
    2020-11-29 17:57

    The potential overflow is in the l+u addition itself.

    This was actually a bug in early versions of binary search in the JDK.

提交回复
热议问题