+ 3

Quick Sort and Merge Sort

Can anyone tell me in simple language why quick sort is preferred for array and merge sort for linked list??

25th Dec 2020, 5:26 AM
Samir Singh
Samir Singh - avatar
3 Answers
+ 6
Quick sort is divide and conquer algorithm so it is recursive so there it is very efficient for arrays bcz it's execution is slow and won't matter as the size of array will be short and merge sort is combination of both recursive and non recursive so it's efficient for linked list as it gives faster result hope it clears your doubt
25th Dec 2020, 6:02 AM
+ 1
I also have same question... But Aysha[left] , both are not devide and conquer algo ? Also both are recursive and has complexity as n log n. Also size of array is not necessarily be small only ... What I feel is that array is contiguous and hence any random access is faster... For quick sort , we need to access randomly for pivot element. Hence , quick sort is best on array compared to link list. Merge sort does not ask for random access of data. I am stil not sure. Is my understanding correct ?
26th Mar 2021, 1:44 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Also below article of SL talks about why to choose merge sort for linked list https://www.sololearn.com/learn/660/?ref=app
26th Mar 2021, 1:46 PM
Ketan Lalcheta
Ketan Lalcheta - avatar