Do not throw in loop, return std::numeric_limits::max
Start sliding merge