Various sorting algorithms, coded for self learning by doing.
Steps of my self learning: I first studied the basic concept of each algorithm from the book. Most often it felt pretty opeque. So for ease I watched various YouTube videos to get a conceptual understanding. After it felt like I've understood the concept, I tried to summerise the concept in code form on my Algorithm note book. Then I consulted the pseudocode given in book (reference bellow) or codes given by other github users(links bellow). After modifying my code "rough", I took a small array of number and manually followed the steps of the algorithm on my khata (note-book). I call this "Walking the Algorithm" or "Manual Walking". Often this step produces the greatest conceptual understanding and revealed many small mistakes. Once manual walking is done, I typed, compiled and ran the code for final testing. This final testing step often revealed many more bugs and refined my understanding of the algorithm even further. As my study progressed I became aware of the bugs and more and more bugs are caught in the manual walking step. Finally when I combined all the algorithms to compile under signle umbrella program, the compilation completed with no compilation error!
Sources:
- Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein. Third Edition, published by MIT press.
- For mergesort: https://gist.github.com/jrelo/8f34a00849c68bbeca95cae802bf910c
- For Quicksort: https://gist.github.com/codeblocks/952063
- AlgoRythmics YouTube channel. This channel presents each algorithm with Hungerian folk dance. Their unique presentation is really inspiring.
- GeeksforGeeks YouTube Channel.
- Other YouTube channels like KC Ang, CS 50 etc.
- Wikipedia pages on various sorting algorithms.