- (O (n)) (O (n ^ 2)).
, , .
So, when you see the algorithm, you find that in insertion sorting you have only comparison n, since when we insert an element, we compare only with the left element and its completion. On the other hand, in the case of quick sorting u, you must continue to compare your rotation element with your entire left element and reduce its array by a constant one factor, resulting in approximately n ^ 2 comparison.
source
share