QUESTION IMAGE
Question
when you implement a bubble sort algorithm, you write _____.
a. two loop structures that are placed at the same level of indentation in sequence: one to swap out - of - order pairs in a list and a second to go through the list repeatedly
b. one fewer loop structure than there are elements in the array
c. a loop that iterates over a list multiple times with a second loop that swaps out - of - order pairs nested inside it
d. an outer loop that makes pair comparisons and an inner loop that controls the number of times you walk through the list being sorted
Bubble sort is a simple sorting algorithm that works by repeatedly stepping through the list, comparing each pair of adjacent items and swapping them if they are in the wrong order. It has an outer loop that controls the number of passes through the list and an inner loop that compares and swaps adjacent elements. The inner loop is nested inside the outer loop.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
C. a loop that iterates over a list multiple times with a second loop that swaps out - of - order pairs nested inside it