naive solution for finding mi:
mi = (li + hi) / 2
the sum of li and hi can potentially be greater than the memory size allocated for the data type, hence can cause errors.
improved solution for finding mi:
mi = li + (hi - li) / 2
li/2+hi/2