Passes:
bold are "sunk" into place
1: 5 19 2 7 28
2: 5 2 7 19 28
3: 2 5 7 19 28
4*: 2 5 7 19 28
*The last pass had no swaps, thus it breaks out of the sort
Efficiency: O(n^2) in random order O(n) when already sorted
You could use a bubble sort.
Bubble sort is also known as sinking sort.
Yes, that's how quick-sort works.
ramesh
no
There are several methods available to sort numbers. A simple way to program sorting is the so-called "bubble-sort". This is inefficient for larger lists of numbers; in which case it is more convenient to use one of the faster algorithms, for example, "quick-sort".
You could use a bubble sort.
rfsghdfhdh
In programming this could be achieved using a numeric bubble sort. Excel allows this type of sorting to be used.
Bubble sort is also known as sinking sort.
Yes, that's how quick-sort works.
ramesh
Bubble sort is an "in place" algorithm. Other than a temporary "switch" variable, no extra space is required.
Sort the following list of numbers in the descending order, 187, 62, 155, 343, 184, 958, 365, 427, 78, 94, 121, 388 using each of the following methods: (i) Insertion Sort (ii) Selection Sort (iii) Heap Sort (iv) Merge Sort (v) Quick Sort Further, count the number of operations, by each sorting method.
bubbles
no
Binary sort and bubble sort are two.