int mid = firstIndex + (lastIndex-firstIndex)/2;
int mid = (low + high) >>> 1;
Both of them are preferred ways, but don't use mid=(low+high)/2; , to find out why read my article : https://siddharthnawani.blogspot.com/2020/05/why-start-end-start2-is-preferable.html
int mid = (low + high) >>> 1;
Both of them are preferred ways, but don't use mid=(low+high)/2; , to find out why read my article : https://siddharthnawani.blogspot.com/2020/05/why-start-end-start2-is-preferable.html
No comments:
Post a Comment