Here's the general method for easily computing the performance of a code segment:

Find out what you want to vary for a section. Ex.: In a sorting algorithm, you vary how many elements to sort. In...