Share EncyclopediaHome EncyclopediaCategories Switch Channel

Sort 10 integers with selection

2026-05-18 03:051680NameNetworking

Selecting a sorting method is an unstable sorting algorithm. It works every time the smallest (or largest) element is selected from the data elements to be sorted, stored at the beginning of the sequence, then continues to search for the smallest (large) element from the remaining unordered elements, and then puts it at the end of the sequence. Pushes in this way until all the data elements are sorted out。

Excerpts from:

Ideas:

Ten elements can be compared between the first element and the second element to produce a larger value, and then to compare the larger value with the next element, the maximum value in ten digits can be derived. If the maximum value is not the first element, the maximum value is exchanged with the first element of the array. In the second round of comparison, starting with the second element, the method was the same as the first。

Select sorting principle

#includeIntmain()
other organiser
i, j, k, m;
int a [10];
printf ( "please enter ten integers;\n");
for (i = 0; i a [k])
k = j;
}//extract the maximum value for each round of comparison
if (k! = i)
other organiser
m=a[i];
a [i] = a [k];
a[k] = m;//a[i] and a[k] numeric interchange, resulting in a [i] maximum value after the round of comparison
♪ i'm sorry ♪
♪ i'm sorry ♪
printf ( "selection-based ranking of ten integers from large to small: \n");
for (i = 0; i)

Select sorting principle

Like 0
Report
Favorite 0
Tip 0
Comment 0
Share 4
MoreRelated Comments
No comments yet, be the first to comment
Old things make dreams. They write love letters for their childhood with junk
Did you ever do that when you were a kid -- you saved a drawer of popsicle sticks to build a small house? The power of the stock, "snatching for the world", has been hidden in the hearts of many。In henan, there's an old man named dachang, who's trying to make it real. Over the past 15 years, nearly 30,000 strangled cans, without entering the recycling site, have become his family's private convoyland cruisers, helicopters, even tanks. Neig

0评论2026-08-0989