A loop placed inside another loop gives a time complexity of:
An squared
Bn plus n
Cn over n
Dn minus n
Answer & Solution
Correct answer: A. n squared
1. The inner loop runs fully for every outer iteration.
2. That multiplies n by n.
3. So the complexity is n squared.
_Source: syllabus Computer Science Class XII, Chapter 5, Sorting._
Keep practising Sorting Algorithms
Browse all Sorting Algorithms questions for Engineering — Tanzania, or explore more Computer Science topics.