Skip to content
Code ReadingOrdered Pairs
Read the Big-O

Ordered Pairs

With n = len(values), how does this function's running time grow?
1def ordered_pairs(values):
2 count = 0
3 for i in range(len(values)):
4 for j in range(i + 1, len(values)):
5 if values[i] < values[j]:
6 count += 1
7 return count