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 are the eight sorts that Java programmers must know?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Java programmers must know what the top 8 order is, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

The relationship between 8 kinds of sorting:

1, insert the sort directly

(1) basic idea: in a set of numbers to be sorted, it is assumed that the previous number (nmur1) [n > = 2] is already ranked.

In good order, now we need to insert the nth number into the previous ordered number, so that the n number

It's in order, too. Cycle again and again until they are all in order.

(2) examples

(3) implement with java

Package com.njue; public class insertSort {public insertSort () {inta [] = {49 public insertSort () {inta [] = {49, 358, 1327, 279, 74, 34, 12, 4, 5, 4, 4, 4, 4, 5, 4, 18, 18, 23, 23, 3, 15, 35, 35, 25, 53, 51); int temp=0; for (int item1, alternate itempl, leading itemp.

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

Development

Wechat

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

12
Report