So, the correct way to calculate mid in binary search is mid = low + ((high - low) / 2) to handle overflow errors.
My implementation uses unsigned 64-bit variables, and I never see a situation where my arrays become so large as to cause an overflow. Should I still use the above implementation or can I use mid = (low + high) / 2
What is the best practice here?
source share