Java Common sorting algorithm "Select, Bubble, Fast"

Source: Internet
Author: User

Select Sort:

Description: Starts with the first element of the array, and in turn contrasts with all other elements, if larger or smaller (depending on ascending or descending), the position is swapped.

Chicesort Code

Bubble Sort:

Description: Compares two adjacent elements in an array, swapping positions if the former is larger. Like bubbles in a beer cup, first float up the biggest bubbles, then float up the second largest bubble ...

Bubblesort Code

Quick sort:

Description: Look for a benchmark (the first or last of the array), the two ends of the table are scanned at the same time, small at the left, large in the right. Then recursively sort from both sides of the datum.

Quicksortcode

Java Common sorting algorithm "Select, Bubble, Fast"

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.