Given the Bubble Sort function template below:

def bubble_sort(list4):
    n = len(list4)
    for i in _______:  # [statement-1]
        for j in _______:  # [statement-2]
            if _______:  # [statement-3]
                # Swap the elements
                _______ = list4[j]  # [statement-4]
                list4[j] = _______  # [statement-5]
                list4[j+1] = temp

Given the following options for the statements:

A. list4[j+1]

B. list4[j] > list4[j+1]

C. range(n-i-1)

D. range(1, n)

E. temp

Choose the correct sequence of statements to complete the bubble sort function.

1
D→C→B→E→A
2
C→D→B→A→E
3
D→C→E→B→A
4
C→D→A→E→B

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation