Java Sorting Algorithm (1): Overview, java Sorting Algorithm Overview

Source: Internet
Author: User

Java Sorting Algorithm (1): Overview, java Sorting Algorithm Overview

Java Sorting Algorithm (I) Overview

Sorting is a very common operation in program development. After sorting an arbitrary set of data elements (active records, you can turn them into a set of ordered sequences sorted by keywords.

For a sorting algorithm, the advantages and disadvantages of the algorithm are generally measured in the following three aspects.

 

1. Time Complexity: It mainly analyzes the comparison times of keywords and the moving times of records.

2. spatial complexity: analyze how much auxiliary memory is needed in the Sorting Algorithm

3. Stability: if the key values of record A and record B are the same, the order of the key values of record A and record B remains unchanged. This sorting algorithm is stable. The opposite is unstable.

 

Internal sorting: According to the existing sorting algorithms, sorting can be roughly divided into internal sorting and external sorting. If the entire sorting does not require external memory (such as disks), all sorting is completed in the memory. This sort is called internal sorting.

External sorting: If there are a large number of data elements involved in sorting, the entire sorting process cannot be completed in the memory by means of external memory (such as disk ), this sort is called external sort.

 

Common internal sorting can be divided into the following categories:

1. Select sorting (directly select sorting and heap sorting)
Ii. Exchange sorting (Bubble sorting and quick sorting)
3. Insert sorting (insert sorting directly, semi-insert sorting, shell sorting)
Iv. Merge Sorting
V. Sort buckets
6. Base sorting

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.