Good article, Osinachi Chukwujama !
Just a minor comment. there's a potential overflow here:
average = floor((min + max)/2)
I tweeted about this not long ago, with an approach that will not overflow (coded in Javascript, but the idea is the same):
average = min + floor((max - min) / 2)
Your DevOps Guy
Learn to think like a software engineer | Ex SDE @amazon