(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

hi, I was asked to notice a pattern involving the run times of sorting algorithms.. however, the run time timer program I have keeps giving me different values for the same length lists :| will the pattern/formula be an approximation then? also, I read that the run time should follow n^2 or some kind of quadratic relation.. I just can't see it, the runtime values I'm getting are no way quadratic. could anybody help me?

thanks

2. Relevant equations

3. The attempt at a solution

here is my selection sort code , it is written in python:

Code (Text):

def swapper(L, i):

larger = i

for e in range(i+1 , len(L)):

if L[e] > L[larger]:

larger = e

return larger

def non_ascending(L):

i = 0

while i != len(L)-1:

larger = swapper(L,i)

L[i], L[larger] = L[larger], L[i]

i += 1

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Sorting algorithms run time

**Physics Forums | Science Articles, Homework Help, Discussion**