Hello, welcome toPeanut Shell Foreign Trade Network B2B Free Information Publishing Platform!
18951535724
  • Sort 10 integers with selection

       2026-05-18 NetworkingName1510
    Key Point: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 c

    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

     
    ReportFavorite 0Tip 0Comment 0
    >Related Comments
    No comments yet, be the first to comment
    >SimilarEncyclopedia
    Featured Images
    RecommendedEncyclopedia