What makes an algorithm fastLesson 4 of 11
Counting a nested loop
Tanvir's duplicate check makes (n − 1) + … + 1 comparisons. Pair the rows and the sum becomes n(n − 1)/2: 190 for 20 orders.
Locked
Unlock the rest of Algorithms and Data Structures: what everything costs.
- Every lesson, every resource, unlocked instantly.
- Track progress and pick up where you left off.
- Free preview lessons stay readable from the outline.