연산횟수는
따라서 시간복잡도는
BubbleSort(arr[]){
arr[SIZE]
for i = 1 to SIZE -1 {
for j = 0 to SIZE - i {
if(arr[j]> arr[j+1]){
swap(arr[j], arr[j+1])
}
}
}
}
InsertionSort(arr[]){
arr[SIZE]
for i = 1 to SIZE -1 {
for j = i to SIZE 0 (j--) {
if(arr[j] < arr[j - 1])
swap(arr[j], arr[j-1])
}
}
}
}
SelectionSort(arr[]){
arr[SIZE]
for i = 0 to SIZE - 1 {
min = i
for j = i + 1 to SIZE {
if(arr[j] < arr[min]){
min = j
}
swap (arr[i], arr[min])
}
}
}