Design and Analysis of
Algorithms Midterm Test
Bank Complete Questions
and Answers Latest
Updated
Page 1 of 6Guidehttps://www.stuvia.com/dashboard!@_)#*)(@$)($@*($@)($@*_1 of 6Design and Analysis of Algorithms Midterm Test Bank Complete Questions and Answers Latest Updated.pdf
, Design and analysis of algorithms - midterm Page 2 2026-03-20
Terms in this set (37)
selection sort description A sort algorithm that repeatedly scans for the smallest item in the list and swaps
it with the element at the current index. The index is then incremented, and the
process repeats until the last two elements are sorted.
selection sort pseudocode for (int start = 0; start< A.length; start++) {
int whereSmallest = start;
for (int i = whereSmallest+1; i < A.length; i++ ) {
if (A[i] < A[whereSmallest]) {
whereSmallest = i;
}
}
int temp = A[start];
A[start] = A[whereSmallest];
A[whereSmallest] = temp;
}
Selection sort time complexity O(n^2)
insertion sort description compares adjacent elements and places them in the correct sorted order of an
array.
Page 2 of 6 2 of 6 Design and analysis of algorithms - midterm.pdf