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

bubble sort
bubble sort

selection sort
selection sort

quicksort
quicksort

merge sort

1 answer

The pseudocode given represents bubble sort.

In bubble sort, the algorithm repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process is repeated until no swaps are needed, indicating that the list is sorted. The pseudocode reflects this behavior by iterating through the list and swapping adjacent elements when the first is greater than the second.

So the correct answer is:

bubble sort.