Hard
What does the While loop do?
sort_insertion(Array 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;
}
listNumbers[j] <-- x;
}
}
Edit
5
Community EvaluationsNo one has reviewed this question yet, be the first!
9
What is recursion?7
What is special about quick sort?2
What is the complexity of this algorithm?3
What about the merge sort method?6
What type of structure are the results of a recursive function stored in?2
Given an array of 17 elements sorted in ascending order, what is the cost of accessing the element with index 10?2
What do you call a structure whose data are nodes and linked together by oriented arcs?