Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the sorting method of Java selection?

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "what is the sorting method of Java selection". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what is the Java selection sorting method"!

The selected sorting method is used to sort a group of data from small to large, and the data are 526, 36, 2, 369, 56, 45, 78, 92, 125 and 52, respectively.

1. The basic algorithm of program analysis selection sorting is to select the smallest array from the interval to be sorted and store it in a [0], then select the smallest value from the remaining sorting interval and store it in a [1], and the number in a [1] is only greater than a [0], and so on, that is, to realize the selection sorting.

2. Program realization

/ * Topic: sort a set of data from small to large by the method of selective sorting The data are * 526, 36, 2, 369, 56, 45, 78, 92, 125, 52 * File Name: Selection_sort * Author: Jack Cui * Created: 31 March 2016 * / # include / * Select sort function declaration * / int* Selection_sort (int* pDataArray Int iDataNum) Void main (void) {int itint iArray [10]; printf ("Please enter 10 numbers:\ n"); for (I = 0

< 10;i++) scanf("%d",&iArray[i]); Selection_sort(iArray,10); printf("快速排序后的顺序为:\n");for(i = 0;i < 10;i++) printf("%5d",iArray[i]); printf("\n");}/***********************************函数名称:Selection_sort*参数说明:pDataArray 无序数组* iDataNum为无序数据个数*说明: 快速排序***********************************/int* Selection_sort(int* pDataArray,int iDataNum){int i,j,iDataTemp;for(i = 0;i < 9;i++)for(j = i + 1;j < 10;j++)if(pDataArray[i] >

PDataArray [j]) {iDataTemp = pDataArray [I]; pDataArray [I] = pDataArray [j]; pDataArray [j] = iDataTemp;} return pDataArray;}

3. Result display (eclipse)

At this point, I believe that everyone on the "Java selection sorting method is what" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report