예제 #1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            RecursiveBinarySearch rbs = new RecursiveBinarySearch();
            int value = -1;

            int[] ADSMarks = new int[] { 72, 55, 1, 61, 38, 96, 45, 73, 57, 39, 6, 88 };

            Array.Sort(ADSMarks);

            txtOutput.Text += "\r\nSorted array: \r\n";
            foreach (int i in ADSMarks)
            {
                txtOutput.Text += i + "\t";
            }
            value = rbs.RecursiveBinarySearch1(ADSMarks, 0, ADSMarks.Length, 61);
            if (value != -1)
            {
                txtOutput.Text += "\r\nValue 61 Found!!\r\n" + "Index of the value : " + value;
            }
            else
            {
                txtOutput.Text += "\r\nValue not found.";
            }
        }