Computing Time Spent on Selection Sort

Objective: Compute the time it takes to perform selection sort on n cards. Call this T(n).

Since each card handling takes a minimum amount of time, say, 1/10 of a second, and a maximum amount of time, say 10 seconds, then since

¼n2 ≤ H(n) ≤ 2n2

We have:

140n2 ≤ T(n) ≤ 20n2

Since T(n) is also between multiples of n2, we say

T(n) = Θ(n2)

Both the number of handlings and the time taken is Θ(n2).

n2 tells the general shape or order of growth of both H(n) and T(n).