A string of data is sorted from smallest to largest

Updated on technology 2024-05-09
6 answers
  1. Anonymous users2024-02-10

    If the program in Tsing Yi upstairs could work, this sentence that generates random numbers may need to rule out the possibility of producing the same number. It doesn't matter if the same value is allowed.

    for(i=0;i<20;i++)

    a[i] = rand()%100;

  2. Anonymous users2024-02-09

    As follows:

    1. First of all, enter the number of different numbers in **.

    2. Then enter the formula to sort these functions, 1 represents ascending and 0 represents descending.

    3. Enter the formula =,a2:a12,1).

    4. Press the Enter key.

    Later, the first number will be sorted by the spike shed.

    5. Pull down the formula and you will find that the sorting is not quite correct.

    6. You can publicize it.

    Add the absolute value symbol to it, and then enter the Zheng Shanxing pull-down to sort it correctly.

  3. Anonymous users2024-02-08

    N inputs at will, arranged in order from smallest to largest, and the outputs are displayed. (Sorting algorithm - selection method sorting).

    Hello and thank you for your question! According to your requirements, we need to use the selection sorting algorithm to sort any n numbers from smallest to largest and display the output. The advantage of the selection sort algorithm is that it only needs to access the array once at a time, no extra space is required, and the efficiency is also very high, and the number of comparisons of the algorithm has nothing to do with the number of elements n, but only with the initial state of the elements before sorting, that is, if the data is basically ordered before sorting, then it will be fast.

    The principle of the algorithm is to select the largest (or smallest) number in the corresponding position from smallest to largest. The algorithm process is as follows: Outer loop:

    From 0 to n-1, cycle n times; Inner Loop: Find the minimum value from I+1 and save the position; Swap the minimum value with the value of the i position; Repeat the inner loop until the comparison reaches the end; Repeat the outer loop until the sorting is complete. Hope these can help you solve the problem, I wish you a speedy solution to the problem, and I wish you a happy life!

  4. Anonymous users2024-02-07

    Idea: Compare the value of the first element in the array with the value of all the elements that follow it, and swap it if the former is greater than the latter, so that the smallest value of all elements is placed in the first element. And so on until the last element.

    Then the specific ** is shown as follows:

    #include

    define n 5 * for 5 numbers in ascending order main().

    The specific operation results are as follows:

  5. Anonymous users2024-02-06

    The algorithm in C enters n (the size of the problem) and then the number of n includevoid main().

    for(i=0;iprintf("%d ",a[i]);Output the sequence)}

  6. Anonymous users2024-02-05

    Arrange a set of data from largest to smallest or from smallest to largest, and the middle number is called the median of this set of data, so the answer is: median

Related questions
6 answers2024-05-09

1. Reproduction methodA bunch of red is propagated by sowing or cuttings to sow more. The sowing season in North China is not limited, and the rest of the region is suitable for spring. A bunch of safflowers is late, spring sowers 9 October flowering, if you want to advance the flowering period or harvest the seeds, the seeds should be sown in a greenhouse or hotbed in early March. >>>More

21 answers2024-05-09

There are two possibilities.

1. Electric vehicle potentiometer. >>>More

3 answers2024-05-09

The answer to the question of how many peach pit skewers are good on the trailer varies from person to person. Here are some possible options: >>>More

5 answers2024-05-09

Have you ever removed your hard drive? Or have you ever attached another hard drive? If you have touched the hard drive, most likely it is because your data cable is wrong, or the power supply of the hard disk is not plugged in, if you have not touched the hard drive, recall your BIOS settings again, the initial settings or optimize the settings.

5 answers2024-05-09

The English screen prompts that no bootable operating system can be found. >>>More