Welcome to the
tool that visualises the existing sorting algorithms in an interactive way.
Sorting plays a key role in algorithms with respect to important applications
including filters,sort by recommendations and a lot more.
This tool is developed to let the users understand the working of each specific
Algorithm.
How to use
Select a sorting algorithm
Click on to start the simulation
Algorithm: Bubble Sort
Bubble Sort(arr, size)
n = size
for i=0 to n-1
for j=0 to n-2
if arr[j]>arr[j+1]
Swap arr[j] and arr[j+1]
end-if
end-for
end-for Time Complexity : O(n2)
Algorithm: Selection Sort
Selection Sort(arr, size)
n = size
for i=0 to n
min = a[i]
index = i
for j=i to n
if arr[j]< min
min = arr[j]
index = j
end-if
end-for
Swap arr[i] and arr[index]
end-for Time Complexity : O(n2)
Algorithm: Insertion Sort
Insertion Sort(arr, size)
n = size
for i=0 to n
temp = arr[i]
j=i+1
while(j>0 and arr[j]>temp)
arr[j+1] = arr[j]
j=j-1
end-while
arr[j+1] = temp
end-for Time Complexity : O(n2)
Algorithm: Merge Sort
MergeSort(arr, left, right):
if left < right
mid = (left+right)/2
mergeSort(arr, left, mid)
mergeSort(arr, mid+1, right)
Merge(arr, left, mid, right)
end-if
Merge(arr,left,mid,right):
i=left
j=0
Time Complexity : O(nlogn)
Algorithm: Quick Sort
Quick Sort(arr, size)
n = size
for i=0 to n-1
for j=0 to n-2
if arr[j]>arr[j+1]
Swap arr[j] and arr[j+1]
end-if
end-for
end-for Time Complexity : O(n2)