pretty-algorithms
pretty-algorithms copied to clipboard
can the sum overflow?
https://github.com/jiayihu/pretty-algorithms/blob/e97dcb78129896b7dc7eb6ec22eba6dd20255bcd/algorithms/search/binary-search/binary-search.ts#L12
It's very unlikely that you have numbers so huge to overflow , especially on the client
You can use (start + ((end - start) / 2) to avoid the overflow, in case that happens.