4 thoughts on “Binary Search using Recursion in C#”

  1. Process is terminated due to StackOverflowException when selecting value 15.

    to correct

    Console.WriteLine(“index no. is {0}”, b.searching(iArray, 0, iArray.Length , number));

  2. The boundaries are wrong when making the recursive call. Please see the correct one below.
    else if (value < array[middle])
    {
    return searching(array, first, middle – 1, value); }
    else
    {
    return searching(array, middle + 1, last, value); }

Comments are closed.