my first blog

I am a science student, majoring in computer information management. Although I am a science student, at the same time I have a strong interest in liberal arts. I think that learning computer knowledge requires not only the logical thinking ability of science, but also the fluent expression ability of liberal arts. If you can have both of these skills, I think this is the computer talent that today's society needs. From now on , While learning the knowledge of professional courses, I will insist on blogging and strive to become that kind of person. I often think that I understand the knowledge explained by the teacher in class, but I find my knowledge loopholes when I review and organize notes after class, and then go to find knowledge to supplement my blind spots. I will make full use of the blog and write my own learning methods and small experiences. I have just learned the sorting method of Java arrays recently. To summarize the selection sorting method: first define the array, use the knowledge of loop nesting, arrange the number of outer layers from large to small, and select the data elements to be sorted each time the inner loop Get the largest element, compare it with the elements behind it, and judge whether it is smaller than the following value. If it is smaller, the two exchange positions. If it is not smaller, the position remains unchanged until all the data elements to be sorted are exhausted.

Bubble sort also uses two layers of for loops. Each time the value of the loop position is taken out and compared with the value of the next position, if the array is larger or smaller (judged by the if logic in the code), the positions of the two values ​​in the collection are exchanged. .

The simplest is the Arrays.sort (array) arrangement method provided by Java. Using this method, a lot of complex codes can be abbreviated, and it is easy to understand. This method defaults to ascending order, from small to large.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325466610&siteId=291194637