edited by
548 views

1 Answer

0 votes
0 votes
bubble sort also called exchange sort is based on comparing the successive elements and then swapping thus largest elements takes its final location after first pass and so on

insertion sort is based upon our natural approach of sorting peck of card by properly inserting the card at its optimal position as it comes so basically there is shifting

when elements r completely sorted there is nothing much to do bubble sort will start from first element from left to right  and there will be no exchange and insertion sort will start with second element and compare to left side and again no shifting is needed..in short  best case , avg case and worst case complexity for these algo r same

Related questions

0 votes
0 votes
1 answer
1
Tuhin Dutta asked Dec 6, 2017
532 views
Consider this array [ 2,2,2,1,1,1,1,1,0,0,0 ].Find the min. no. of swaps needed for this array to be sorted in asc. order using:a) bubble sortb) insertion sort
1 votes
1 votes
1 answer
2
PriDix asked Feb 26, 2017
1,667 views
A machine takes 200 second to sort 200 names, using bubble sort . In 800 seconds , it can approximately sort how many names?