Bubble, selection and insertion sort all have a time complexity of:
An squashed
Bn stacked
Cn shortened
Dn squared
Answer & Solution
Correct answer: D. n squared
1. All three compare elements pairwise across repeated passes.
2. The work therefore grows with the square of the size.
3. Bubble sort, selection sort and insertion sort all have a time complexity of n squared.
4. So the answer is n squared.
_Source: syllabus Computer Science, Ch 5 'Sorting' and Ch 6 'Searching'_
Keep practising Sorting and Searching
Browse all Sorting and Searching questions for IGNOU MCA, or explore more Computer Science topics.