Math, asked by bhallakunj1415, 1 year ago

Write insertion sort algorithm. Explain the average case analysis.


mahi0409: Just asking out of curiosity which class are you in
VasudhaJadhav13: 8 class
mahi0409: you are studying sorting algo in 8 class.
mahi0409: ??
mahi0409: icsc bord

Answers

Answered by Anonymous
5

ANSWER__✍️

Merge Sort :

Worst, Average and Best Case - O(n*log(n))

Quick Sort :

Worst case - O(n^2)

Average, Best Case - O(n*log(n))

In terms of space complexity, quick sort is space constant, merge depends on the structure provided as input.

Generally, quick sort is considered better as compared to merge sort.

Similar questions