Answer algorithms

I don't think you need the .floor here. It will floor whatever the middle element ends up being. So, if the middle element is 5.5, it will return 5, which will be incorrect.