- First, we will generate a random array using Math.random() function.
- Different colors are used to indicate which elements are compared, left partition and right partition.
- Since the algorithm performs the operation very fast, the setTimeout() function has been used to slow down the process.
- New array can be generated by pressing the “Ctrl+R” key.
- The sorting is performed using QuickSort() function using hoare_partition() function
Below is the program to visualize the Quick Sort algorithm.