added the code for quick sort with comments