Page 466 - computer science (868) class 11
P. 466

45               System.out.println("THE SORTED ARRAY IS :-");
                46               for(i=0;i<n;i++)

                47                   System.out.println(ar[i]);
                48           }

                49
                50           public static void main()

                51           {
                52               Selection_Sort ob=new Selection_Sort();
                53               ob.read_list();

                54               ob.sort();

                55               ob.display();
                56           } //end of main
                57       } //end of class


              The output of the preceding program is as follows:
              ENTER THE SIZE OF THE ARRAY
              5
              ENTER THE ARRAY ELEMENTS
              22
              55

              33
              44
              77
              THE SORTED ARRAY IS
              22
              33
              44
              55
              77


                                                         Variable Description
                 NAME         TYPE                                       DESCRIPTION
                i          int          Loop variable
               ar[]        int          To store array elements
               n           int          To store array length

               x           int          Index of minimum value
               j           int          Loop variable
               startindex  int          Index value in the beginning
               p           int          Index of the minimum value



                464464  Touchpad Computer Science-XI
   461   462   463   464   465   466   467   468   469   470   471