The following algorithm represents the logic of a(n) ____.
// Outer loop designates a position
// from first to last element
For currEl = 0 To ARRAYSIZE - 1
MinValue = someNums[currEl]
MinPosition = currEl
// Inner loop steps through array,
// finding smallest value
For index = currEl + 1 To ARRAYSIZE - 1
If someNums[index] < minValue Then
MinValue = someNums[index]
MinPosition = index
End If
End For
// Swap minimum value with element at
// designated position if different
If minPosition != currEl Then
Temp = someNums[currEl]
SomeNums[currEl] = someNums[minPosition]
SomeNums[minPosition] = temp
End If
End For
A) selection sort
B) insertion sort
C) bubble sort
D) merge sort
Correct Answer:
Verified
Q20: A(n) _ is the most straightforward sorting
Q21: A(n) _ involves comparing adjacent elements and
Q22: A(n) _ finds which element belongs in
Q23: A(n) _ builds a sorted array by
Q24: A sorting algorithm can involve switching the
Q25: Which of the following swaps the values
Q26: In a(n) _, the number of comparisons
Q27: The following algorithm represents the logic of
Q29: The following algorithm represents the logic of
Q30: To reverse the order of array elements,
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents