Which of the following sort algorithms is represented by the pseudocode?

for all elements of list

if list[i] > list[i+1]

swap(list[i], list[i+1])

end if

end for
(1 point)
Responses

quicksort
quicksort

bubble sort
bubble sort

selection sort
selection sort

merge sort

1 answer

The pseudocode provided is representative of bubble sort.

In bubble sort, the algorithm repeatedly checks adjacent pairs of elements in the list and swaps them if they are in the wrong order (i.e., the first element is greater than the second). This process is repeated for all elements in the list until no swaps are needed, indicating that the list is sorted.

Therefore, the correct response is:

bubble sort