All pastes #494027 Raw Edit

Miscellany

public python v1 · immutable
·published 2007-05-18 01:52 UTC
rendered paste body
#!/usr/bin/env python# Playing around with insert sort.# First we populate a list of numbers.import randoma = [random.randint(0,10000) for i in range(random.randint(100,1000))]print aprint "the length of A is %i" % (len(a))for j in range(1,len(a)):        print "j is %i a[j] is %i" % (j, a[j])        key = a[j]        i = j - 1        while i>-1 and a[i]>key:                a[i+1] = a[i]                i = i - 1        a[i+1] = keyprint a