Information on Sorting algorithms
1. Stable: Equal keys aren’t reordered
2. In place: Requires only one extra space
3. Internal Sorting: Data to be sorted are placed in the main memory
4. Adaptive: Takes advantage of pre-existing order in the data to improve
performance.
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