Selecting a pivot from the linked list, typically the last node.
The linked list is then partitioned such that all elements smaller than the pivot are placed on the left, while those greater than the pivot are placed on the right.
Once the partitioning is complete, the algorithm recursively applies the same process to the left and right linked lists.
The sorted left list, pivot and right list are combined to get the complete sorted list.
Output
3 4 5 20 30
Time Complexity: O(n * log n), It takes O(n2) time in the worst case and O(n log n) in the average or best case.