Medium
What is the complexity of this algorithm?
sort_insertion(listNumbers)
{
For i from 1 to size_of_listNumbers - 1
{
x <-- listNumbers[i];
j <-- i;
While j > 0 and listNumbers[j - 1] > x
{
listNumbers[j] <-- listNumbers[j - 1];
j <-- j-1;
}
listNumber[j]<-- x;
}
}
Author: KahinaStatus: PublishedQuestion passed 856 times
Edit
2
Community EvaluationsNo one has reviewed this question yet, be the first!
2
Given an array of 17 elements sorted in ascending order, what is the cost of accessing the element with index 10?6
What does the While loop do?2
What can be said about a terminal algorithm?10
What is special about quick sort?12
What is recursion?8
What type of structure are the results of a recursive function stored in?5
What about the merge sort method?