Why Quick Sort preferred for Arrays and Merge Sort for Linked Lists? – Searching and Sorting – Quick Sort in its general form is an in-place sort. whereas merge sort requires O(N) extra storage, N denoting the array size which may be quite expensive.
quicksort algorithm with example
QuickSort on Doubly Linked List – Searching and sorting -. The idea is simple, we first find out pointer to last node. Once we have pointer to last node, we can recursively sort the linked list using pointers to first and last nodes of linked list.
Iterative Quick Sort – Searching and Sorting – Partition process is same in both recursive and iterative. The same techniques to choose optimal pivot can also be applied to iterative version.
Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted -Searching and sorting – Given an unsorted array arr[] of size n. find the minimum length subarray arr[s..e]
Which sorting algorithm makes minimum number of memory writes – Searching and Sorting – Minimizing the number of writes is useful when making writes to some huge data set is very expensive, such as with EEPROMs or Flash memory, where each write reduces the lifespan of the memory.
When does the worst case of Quicksort occur? – Searching and sorting – Since these cases are very common use cases, the problem was easily solved by choosing either a random index for the pivot.
QuickSort – Searching and Sorting – Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions.There are many different versions of quickSort that pick pivot in different ways.