107k views
1 vote
In a bubble sort for a list of length n >= 2, in each iteration, the first step is to compare_______.

User Iamzozo
by
7.6k points

1 Answer

5 votes

Answer:

the consecutive two elements and swap them based on the value which is larger if we go for ascending order

Step-by-step explanation:

bubble sort compares 2 consecutive elements of the list and swap them. in one iteration one value will be placed correctly depending on the sorting order either ascending or descending

User Pankaj Gadge
by
8.9k points