Computer Science, asked by ratansy0123, 6 months ago

Q9
Which of the following comparison sort gives the least comparisons?
Ops: A. O Quick Sort
B.
O Merge Sort
&
C. O Heap Sort
D. O Bubble Sort​

Answers

Answered by jainpayal288
1

Answer:

o merge sort

hope It helps you

Answered by aditijaink283
0

Answer:

The answer to the given question is:

B. Merge Sort

Explanation:

Merge sort is useful to sort a linked list in O(nLogn) time. In the case of a linked list, the difference is mainly due to the difference in memory allocation of the array and the linked list. Unlike arrays, linked list nodes may not be contiguous in memory. Unlike an array, in a linked list we can insert elements in between in O(1) additional space and O(1) time. Thus, the merge operation of merge sort can be performed without extra space for the linked list.

In arrays, we can perform random access because the elements are contiguous in memory. Suppose we have an array of integers (4 bytes) A ​​and the address of A[0] is x then to access A[i] we can directly access the memory at (x + i * 4). Unlike arrays, we cannot perform random access in a linked list. Quicksort requires a lot of this type of access. In a linked list to access the i-th index, we have to iterate through each node from the beginning to the i-th node because we don't have a contiguous block of memory. Therefore, the cost increases fast. The merge sort accesses the data sequentially and the need for random access is low.

#SPJ5

Similar questions