Java Important sort

Source: Internet
Author: User

Sort of need chestnuts, for a Li Zixian 23 32-1 42 32-2 24 17 71 3332-1 and 32-2 for two identical numbers 32, except that the position is different, to determine whether the order is stable and stable means: in front of the The numbers are still in front of the order.
Select Sort-- unstable1. Each round to find the smallest subscript 17-->6 (subscript),-->1 (subscript) Subscript Exchange 2. Keep cycling, know all the numbers are orderly.
Insert sort--stable1. Each round extracts one from the array, that is, the first 2. The first loop, the first number in the first, and the next number in the new queue to find his proper location
Bubble Sort--stableThe number of Wei ' zhi ' bu ' bian per cycle is moved to the last
Quick Sort-- unstable1. The first number 23 as the benchmark 2. Take the farthest number and he's bigger than him: Take out the number position unchanged continue the next loop small: 17 23 Exchange Benchmark Move 3 The result of the cycle is that the benchmark is in the middle, the front number is smaller than the benchmark, and the number behind the benchmark is bigger.
Heap Sequencing-- unstable1. Insert the number in accordance with the full binary tree rule, left dial hand tree small, right sub-tree big, upper than next big, root node put maximum number
2. Put the two-fork tree into the array by row (breadth-first traversal)3. Each loop is presented with Root and ensures that the remaining remains a fully binary tree: the number that is larger on each parent node is satisfied. After removing root, find the child nodes of root, compare the largest number between them, and become root constantly looking, replacing, until the remaining number satisfies is a complete binary tree.
Bucket Sort-- is the fastest in all sorts
I'm here to talk about the heap sort and the bucket sort:http://blog.csdn.net/mon_key_dt/article/details/41652031

small white long to see, hope that you more suggestions.

Java Important sort

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.