binary search vs trinary search(Ruby)