tituzimalett tituzimalett
  • 27-03-2017
  • Computers and Technology
contestada

Why is insertion sort faster than quicksort for small arrays?

Respuesta :

spartan1244 spartan1244
  • 27-03-2017
It's not guaranteed to be faster on small arrays, but it can be. The organization of the data is probably more important than the size. If look at the complexity's of the two algorithms you can find your answer. Quicksort worst case is O(n^2) but its average is O(nlogn). Insertion sort is average and worst case is both O(n^2). So the best conclusion would be if the data was arrange so the quicksort pivot selection is at it's worst, then I guess insertion could be faster.
Answer Link

Otras preguntas

Write a system of equations with a solution (4,–3)
Does every point lie in a quadrant?
The value square root of 53 of lies between which two consecutive integers?
How do scientists use seismic waves to determine the interior structure of Earth?
the cafeteria has 45 square  tables that can be pushed together to form one long table for the lacrosse team's banquet. Each square table can seat one person on
Alicia estimates that the surface area of a rectangular prism with a length of 11 meters,a width of 5.6 meters,and a height of 7.2 meters is about 334 cubic met
Write a system of equations with a solution (4,–3)
The length of a diagonal of a cube with edge length 25cm
Find the value of x.  Round to nearest hundredth if necessary.
“The genetic code is universal.” Explain this statement.