Sorting Algorithms Some Info
Sorting Algorithms Some Info
procedure bubbleSort(arr)
for i=0 to n-1
for j=0 to n-i-1
if arr[j] > arr[j+1]
Swap arr[j] and arr[j+1]
end if
end for
end for
end procedure
procedure modifiedBubbleSort(arr)
flag = true
for i= 0 to n-1 do
for j=0 to n-i-1
if arr[j] > arr[j+1]
Swap arr[j] and arr[j+1]
flag = false
if flag is true
break
end if
end for
end for
end procedure