C# - Determine the advance and retreat method of the search interval