Search This Blog

Wednesday, January 30, 2013

SELECTION SORT

import java.io.*;
class selectionsort
{
public static void main(String args[])throws IOException
{
    int x[]=new int[10];
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    System.out.println(" Enter 10 Integer values ");
    for(int i=0;i<10;i++)
    {
          x[i] = Integer.parseInt(br.readLine());      //input array of numbers
     }
     int h,p=0;
    for(int i=0;i<10;i++)
    {
        h=x[i]; 
        for(int j=i+1;j<10;j++)  //loop for comparison with next element
        {
            if(x[j]>h) //descending order
            {
                h=x[j];
                p=j;
            }
        }
        x[p]=x[i];  //swap
        x[i]=h;
    }
System.out.println(" After Sorting");
for(int i =0;i<=x.length-1;i++)
{
System.out.println(x[i]);
}
}
}

22 comments:

  1. Thank You vey much this help me much.Can you please post the program for Bubble Sort with detailed comments please,Cuz i need sorting techniques for my Board exams which are starting from tomorrow and i need help in sorting techniques.

    ReplyDelete
  2. And one more thing how can i do it with Strings instead with integers

    ReplyDelete
    Replies
    1. Go to class 10th ICSE boards question papers solved of Computer Application 2017 question number 9

      Delete
  3. you're really a excellent webmaster. The site loading speed is incredible. It seems that you are doing any distinctive trick. Also, The contents are masterwork. you've performed a great job in this subject!


    my weblog; graduate certificate programs online

    ReplyDelete
  4. can you put some Java projects for class 10th ICSE.it will be quite helpfull

    ReplyDelete
  5. Every weekend i used to pay a visit this web site, as i want enjoyment, since this this web site conations
    genuinely fastidious funny stuff too.

    Here is my site - how kids can make money online for free

    ReplyDelete
  6. In fact when someone doesn't know after that its up to other people that they will help, so here it occurs.

    my page :: good way to make money online

    ReplyDelete
  7. Hey there! Someone in my Myspace group shared this website with us so I came to take a look.
    I'm definitely enjoying the information. I'm book-marking
    and will be tweeting this to my followers! Fantastic blog and excellent design and style.


    Here is my homepage; how to make money fast online

    ReplyDelete
  8. Because the admin of this website is working, no doubt
    very quickly it will be well-known, due to its feature
    contents.

    Look at my web-site; do people really make money online

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. sir
    i am ntasha i am a teacher in a private school and don't have any info about the syllabus so now i ma finding ICSE Syllabus 2015
    to my students so pls send me info about this year's syllabus....

    ReplyDelete
  11. Give your views and rate points to your school at Boscui .
    Help Others gain a real insight about your School.
    Arts colleges in india

    ReplyDelete
  12. hey!!! you are an ex-yadavindrian! even i'm a yadavindrian!!!! yps rocks! you're doing a great job through this blogspot!!!! extremely useful stuff

    ReplyDelete
  13. sir i want to do job in Staff Selection Commission and searching for SSC Notification. please provide complete detail regarding SSC Online Application.

    ReplyDelete
  14. good thxx
    can u provide it i scanner class

    ReplyDelete
  15. nice information shared thank you and i am interested to visit again. I have understand your stuff previous to and you are just too great.
    I actually like what you’ve acquired here, certainly like what you’re stating and the way in which you say it.
    Kerala TET Answer Key 2016
    TSPSC Group 2 Result

    ReplyDelete
  16. All Railway Recruitment in Kolkata has released. Candidates who wants to apply get important details on RRB kolkata Recruitment.

    ReplyDelete
  17. Get online ICSE syllabus @ RecruitmentInboxx.com online in PDF format.

    ReplyDelete

  18. tHANK YOU for the Kind Information. This information is very much useful like Downloadallsoft.com. You can allow me to post the upword comment.allinonedictionary.com. Thank you again for posting this.
    tHANKS

    bdjobmarket.com

    ReplyDelete
  19. But this is bubble sort,bro.
    😒 😒 😡 😡

    ReplyDelete
  20. To get more such informative updates visit SarkariJoblive.in and get daily dose of all Government/Private Jobs notification.

    ReplyDelete
  21. this seems like a place i should give a shot after finishing my writing helper work. i really like drinking juices and this place could be like a heaven for me. thank you for sharing the location with us. Search picbear to discover nice photos and videos on instagram.

    ReplyDelete