Question DSA-SORT-0072
HardWhat is the average number of swaps in bubble sort on a random permutation of n elements?
- A.
n(n − 1)/4
- B.
n log n
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Sorting question
What is the average number of swaps in bubble sort on a random permutation of n elements?
n(n − 1)/4
n log n
Sign up free to see the answer and a step-by-step explanation.
n²
n