+ 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??
2 odpowiedzi
+ 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 ?
+ 1
Also below article of SL talks about why to choose merge sort for linked list
https://www.sololearn.com/learn/660/?ref=app