Exercise

Correcting a bug in the bubble sort algorithm

You have been given a program that sorts a list of numbers using the bubble sort algorithm. While testing it, you realize that the code is not correct. Could you correct the algorithm so that it works correctly?

Instructions

100 XP
  • Correct the mistake in the assignment of the is_sorted variable.
  • Correct the mistake when checking the adjacent values.
  • Correct the mistake when updating the value for the list_length variable.