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

merge sort
merge sort

quicksort
quicksort

selection sort

1 answer

The pseudocode you provided represents bubble sort.

In bubble sort, adjacent elements are compared, and if they are out of order (i.e., the first element is greater than the second), they are swapped. This process is repeated for all elements of the list until no more swaps are needed, which indicates that the list is sorted. The code snippet reflects the essence of this algorithm.