Page 514 - Cs_withBlue_J_C11_Flipbook
P. 514

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



                512512  Touchpad Computer Science-XI
   509   510   511   512   513   514   515   516   517   518   519