You are on page 1of 1

Sorting Algorithms : Bubble Sort & Selection Sort

Group Correspondent : In the assignment 7 , we get two types of Sorting Algorithms called

Bubble Sort and Selection Sort, where we write a program to print the required time execution

of both Algorithms, And also we improved our Bubble Sort Algorithms. After achieving both of

this Algorithms, we get some ideas about Sorting. For example, What are the time complexity

of that program, How work it is ,Which one is faster than other one ,Which one is the easiest,

etc. Now, we briefly tell about both of this Algorithms, Bubble Sort is comparison-based Sorting

Algorithms , it works by comparing adjacent pairs of objects in the array. If they are not in

correct order, they will be swapped, And new pairs will be ascending order. After complete

Bubble Sort Algorithms, then we improved it, Where we use a condition (either true or false) ,If

the pairs are already in order, then we break this pair. The next Algorithms is Selection Sort

Algorithms ,Which is sorted data by finding smallest number in the array , then swapped each

other. In Both of this Algorithms ,I think Selection Sort is the best Sorting Algorithms though

they have same time complexity[ O( n*n ) ] and same space complexity[ O( 1 ) ], Because of

Selection Sort complete the swapping case in outer loop. So, numbers of swaps is ”(SIZE –

1)” ,While Bubble Sort complete the swapping case in inner loop which takes “SIZE*(SIZE-1)/2”

times swaps that’s why it will takes too many time to execute the program than the Selection

Sort.

You might also like