Selection Sorting

19 comments
Sorting means to sort an array of data. Say you had an array of numbers [2,4,6,1,3,5] and you sorted it (in ascending order), you'd get [1,2,3,4,5,6].

There are many different types of sorting, refered to as sorting algorithms. You can find out about some of the primary ones (bubble, selection, insertion, merge).




 Selection Sorting in Ascending Manner
 #include<iostream.h>
 #include<conio.h>

 void main()

 {  clrscr();
 int i,j ,s,temp,p;
 int a[5]={5,9,3,7,1};

 cout<<"\n";
 cout<<"corginal array is: \n";
 for(i=0;i<5;i++)
  cout<<a[i];

 for(i=0;i<5;i++)
  {
    s=a[i];
    p=i;

    for(j=i;j<5;j++)
    {
    if(s>a[j])
    {
     s=a[j];
     p=j;
    }
    }
    temp=a[i];
    a[i]=a[p];
    a[p]=temp;
    }

    cout<<"\n";
 cout<<"sorted array is: \n";
 for(i=0;i<5;i++)
  cout<<a[i];
     getch();
    }

OUTPUT:



19 comments:

really helpful!!!

16 December 2016 at 16:33 comment-delete

i love it
a great site for c++

13 December 2018 at 05:36 comment-delete

Lovely explanation of a language with a complicated task in a very simple program.
mobile service center in vadapalani

6 March 2019 at 20:47 comment-delete

Wonderful Blog post, great article that you have provided for peoples. Its really good. Nice information.



Data Science Courses in Bangalore

13 May 2019 at 22:20 comment-delete

I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
date analytics certification training courses
data science courses training
data analytics certification courses in Bangalore
ExcelR Data science courses in Bangalore

16 May 2019 at 04:31 comment-delete

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful.





BIG DATA COURSE MALAYSIA

30 May 2019 at 04:50 comment-delete


I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.Data Science Courses

26 June 2019 at 23:47 comment-delete

Thanks for sharing useful information. I learned something new from your bog. Its very interesting and informative. keep updating. If you are looking for any Data science related information, please visit our website bigdata training institute in bangalore.

4 December 2019 at 22:01 comment-delete 8 June 2020 at 00:54 comment-delete

Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.

Correlation vs Covariance

8 June 2020 at 21:25 comment-delete

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. data scientist courses

12 October 2020 at 03:37 comment-delete


ExcelR provides Data analyst course. It is a great platform for those who want to learn and become a Data Analyst. Students are tutored by professionals who have a degree in a particular topic. It is a great opportunity to learn and grow.

Data analyst course

8 March 2021 at 01:19 comment-delete

In the wake of perusing your article, I was astounded. I realize that you clarify it well overall. What's more, I trust that different perusers will likewise encounter how I feel in the wake of perusing your article.
data scientist training and placement

15 April 2021 at 22:10 comment-delete

Really an awesome blog, With informative and knowledgeable content. Thanks for sharing this blog with us. Keep sharing more stuff again.
Data Science Online Training

20 January 2022 at 22:27 comment-delete

Pleasant data, important and incredible structure, as offer great stuff with smart thoughts and ideas, loads of extraordinary data and motivation, the two of which I need, because of offer such an accommodating data here.
data analytics training in hyderabad

1 February 2022 at 02:55 comment-delete

Thank you so much for doing the impressive job here, everyone will surely like your post.
full stack web development course malaysia

17 March 2022 at 04:18 comment-delete

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post . data analytics course in surat

5 April 2022 at 22:15 comment-delete

You completed certain reliable points there. I did a search on the subject and found nearly all people will agree with your blog.
data science training in hyderabad

7 April 2022 at 04:38 comment-delete 26 May 2022 at 11:05 comment-delete
Post a Comment

Copyright 2011 Programming In C++.
Blogger Template by lordhtml / Free Blogger Template