There have been many times, we get doubts about how a certain algorithms work. There is no better way than being able to visualise that algorithm. For example check this page where you can see how each sort works on same array input. I used to embed their webpage but now they have blocked cross site embedding, hence you need to go their page to see the animation.
Open the URL and click on the algorithm so that you can visualise how each algorithm sorts.
These are created by David Galles, an Associate Professor of department of Computer Science University of San Francisco.
You will be able to see lot more visualizations by going to this page.