edited by
835 views
0 votes
0 votes

Please correct if any of the point is wrong :

Quicksort:
1.Need more random accesses

2 Used when Random access is fast (hence preferred on array and not on Linked List)

2 No extra space needed ==> Inplace

4 Not a stable sorting algorithm

5 even in worst case using randomized quick sort (O(n^2)

MergeSort:

1 Need Less random accesses than quicksort

2 Preferred When random access is very slow(On linked list)

3 why Not preferred for array over quicksort ?? ==> Extra space needed auxillary array O(N)

4 Extra space needed when applied on Array | No extra space needed when applied on Linked List

4 Stable sorting algo

Somone please explain this point its from geeksforgeeks:

Quicksort in particular exhibits good cache locality and this makes it faster than merge sort in many cases like in virtual memory environment.

edited by

Please log in or register to answer this question.

Related questions

189
views
1 answers
0 votes
halfcodeblood asked May 26
189 views
How to approach this type of questions?
2.5k
views
3 answers
1 votes
Akash Kumar Roy asked Apr 21, 2018
2,539 views
First read it properly. I am not asking a specific question about space complexity.Question: What is worst case space complexity of quick sort?Everywhere it is showing O ... is worst case, wouldn't it be requesting for O(n) stack records?
863
views
1 answers
0 votes
LavTheRawkstar asked Jan 12, 2017
863 views
INSERTION-SORT (A, n) ⊳ A[1 . . n]for (j ← 2 to len(A) ){key ← A[ j];i ← j – 1 ; while (i > 0 and A[i] > key) { A[i+1] ← A[i]; i ← i – 1; }A[i+1] = key;
729
views
1 answers
1 votes
ykrishnay asked Aug 5, 2022
729 views
as we allocate the space for node in linked list using malloc() so how many bytes malloc allocate for the 1 node i.e. actual value of malloc allocates in ram like ... )); printf("%d",sizeof(struct node)); } what the printf prints and why ?