In bubble sort we compare two adjoining elements and exchange them if they are not in proper order. We repeat this process for next two adjacent elements. In the first pass the heaviest element gets settled to the bottom of the list. Similarly, in the second pass the second heaviest element settles on top of the first heaviest element, and so on we repeat the process for n-1 passes in total. To understand this, see the bubble sort animation in this video:
Here is the code for bubble sort:
2 comments:
hey nice work and cool animation!
I have started a similar blog too, though not as cool as yours!
keep up the good work!
Thank you, Shyambhu. I have just checked your blog. Its awesome, and i hope to learn some new things from it.
Thank you.
Post a Comment