The example in this article describes how Java uses a bubble sort array to sort the arrays. Share to everyone for your reference. Specifically as follows:
First, bubble sort:
Sort arrays by bubble sort
Ii. Basic Concepts:
In turn, compare the
First, bubble sort:Sort an array by using bubble sortSecond, the basic concept:Compare adjacent two numbers in turn, place decimals ahead, and large numbers behind. That is, in the first trip: first compare the 1th and 2nd numbers, put the decimals
Sorting is a problem that we often face in our lives. Students in the exercise will be in accordance from the low to high arrangement, the teacher to check the attendance in class, will be in accordance with the student number sequence name, the
C # Insert Sort bubble Sort Select sort Quick sort Heap sort Merge sort base Sort Hill sortThe following is a list of eight basic sorts of data structures and algorithms: Insert sort bubble Sort Select sort Quick sort Heap sort Merge sort base sort
C # Insert Sort bubble Sort Select sort High speed sort heap sort merge sort base Sort Hill sortThe following is a list of eight basic sorts of data structures and algorithms: Insert sort bubble Sort Select sort High speed sort heap sort merge sort
1. Bubble sortThe origin of the noun is very well understood, the General river in the bubble, the bottom just came out of the time is relatively small, with slowly floating to the surface will gradually increase.The bubbling algorithm operates in
first, the principle of the algorithm
Compares the adjacent elements. If the first one is bigger than the second one, swap them both.
Do the same for each pair of adjacent elements, starting with the last pair from the first pair to the
The fast sorting method mainly utilizes a method of arrays to Arrays.sort () implementation.
Bubble method is used to compare the traversal array, through the constant comparison of the minimum or maximum value of a single traversal.
The Select
1. Compare and sort bubble sort, and sort bubble
Bubble Sorting is one of the most entry-level algorithms in sorting algorithms. It is easy to understand and often serves as an entry-level Algorithm for sorting in the classroom.
Bubble Sorting is
Related articlesAlgorithm (i) Time complexityPrefaceSorting is the basis of the algorithm, there are many ways to sort it out, some methods are simple to implement, but inefficient, we can call these sorts of methods an elementary sort. In this
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.