Page 570 - ComputerScience_Class_11
P. 570

56               }
                57               if(p!=-1)

                58                   System.out.println("YES. THE POSITION IS "+(p+1));
                59               else

                60                   System.out.println("NOT FOUND");
                61           }

                62
                63           public static void main(String args[])

                64           {

                65               Bubble_Binary ob=new Bubble_Binary();
                66               ob.accept();

                67               ob.Bubble_Sort();
                68               ob.binary_search();

                69           }                                    //end of main
                70       }


              The output of the preceding program is as follows:

                     BlueJ: Terminal Window - Java
                 Options

                ENTER THE SIZE OF THE ARRAY
                5
                ENTER THE ARRAY ELEMENTS
                1
                6
                5
                2
                4
                THE SORTED ARRAY IS:-
                1
                2
                4
                5
                6
                ENTER THE NUMBER TO BE SEARCHED
                5
                YES. THE POSITION IS 4














                  568  Touchpad Computer Science (Ver. 3.0)-XI
   565   566   567   568   569   570   571   572   573   574   575