Q9. Bubble Sort Is Implemented Using A Technique That Repeatedly Compares Adjacent Pairs
Q9. Bubble Sort Is Implemented Using A Technique That Repeatedly Compares Adjacent Pairs
Q9.
Bubble sort is implemented using a technique that repeatedly compares adjacent pairs of elements from left to right and swaps them if they are in the wrong order. Which of the following is the total number of comparisons for sorting a list of n elements? n 2 n(n + 1) 2 n(n 1) c) 2
n 2
2
a)
b)
d)
Q9.
Bubble sort is implemented using a technique that repeatedly compares adjacent pairs of elements from left to right and swaps them if they are in the wrong order. Which of the following is the total number of comparisons for sorting a list of n elements? n 2 n(n + 1) 2
n(n 1)
n
2
a)
b)
c)
d)