ActionScrip 3 code demo:
var temp: int = 0,
i: int = 0,
j: int = 0,
array: Array = [];
function BubbleSort(n: int) {
for (i = 0; i < n - 1; i++) {
for (j = i + 1; j < n; j++) {
if (array[i] > array[j]) {
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
}
References
- https://en.wikipedia.org/wiki/Bubble_sort
- http://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort
- http://code.tutsplus.com/tutorials/quick-tip-implementing-the-bubble-sort-in-as3--active-10728
- https://www.hackerearth.com/notes/sorting-code-monk/
- https://www.quora.com/What-is-the-fastest-sorting-algorithm
0 comments:
Post a Comment