passdrill
School · Coding & Computers · Card 009/010 hard

Bubble sort repeatedly steps through a list, and on each pass compares each pair of neighbouring elements. What does it do when it finds a pair that is in the wrong order?

  1. It removes one of the two elements from the list entirely
  2. It moves the smaller element all the way to the very front of the whole list immediately
  3. It swaps the two neighbouring elements, then continues comparing the next pair further along the list
  4. It stops the entire sorting process and restarts from the very beginning of the list
Next card → Shuffle