It's a trivial binary chop:
Binary search algorithm - Wikipedia, the free encyclopedia[
^] - and frankly, if you can't work it out from that simple code, then you need to go back to your course notes and start reading from the begining again.
This is trivial stuff. If you don't understand this, then the next exercise your tutor gives you is going to be nearly impossible...