Application System sorts for sorting algorithm part I week 3 in Princeton University algorithm Course

Source: Internet
Author: User

Sorting algorithms are widely used.

Typical applications:

  • Sort name
  • Sort MP3 music files
  • Display Search Results of Google's web page ranking
  • List RSS subscriptions in order of titles

After sorting, the following problems become very simple.

  • Median)
  • Identify abnormal values in statistical data
  • Binary Search in the database
  • Find duplicate emails in the mailbox

Not a typical application:

  • Data Compression
  • Computer Graphics
  • Computing creature
  • Load Balancing

Java System sorting (system sorts)

Arrays. Sort ().

  • Different Methods correspond to different basic types.
  • There is a method to implement the comparable Interface
  • There is a way to use Comparator
  • Use optimized quick sorting for basic types and optimized Merge Sorting for objects

The ordering of Java systems is not completely reliable.

Sorting Algorithm types:

Internal sorting:
Insert sorting, select sorting, Bubble sorting, and sieve sorting
Fast sorting, Merge Sorting, heap sorting, Hill sorting, and samplesort)
Card Sorting, red/Black sorting, open sorting, yaroslavskiy sorting, and P sorting

External sorting:
Multi-phase Merge Sorting, stacked merge, and oscillating sorting

String sorting:
Distributed sorting, MSD, LSD, and three-way fast sorting

Parallel sorting ::
Bitonic sorting and batcher parity sorting
Smooth sorting, cube sorting, and column sorting
GPU sorting

Which algorithm should I choose?

Select an algorithm as needed.

  In-situ sorting Stability Worst Average Best Remarks
Select sort Yes   N^ 2/2 N^ 2/2 N^ 2/2 Minimum number of exchanges
Insert sort Yes Yes N^ 2/2 N^ 2/4 N Applicable to small arrays and partially sorted Arrays
Hill sorting Yes   ? ? N Less code, complexity n ^ 1.5
Merge Sorting   Yes N lgn N lgn N lgn Stable complexity
Fast sorting Yes   N^ 2/2 2n lnn N lgn Fastest speed in practical application
Three-way sorting Yes   N^ 2/2 2n lnn N It is an improvement of normal quick rank.
??? Yes Yes N lgn N lgn N lgn God Algorithm

 

 

Application System sorts for sorting algorithm part I week 3 in Princeton University algorithm Course

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.