# demonstration of sort speeds
# Although there are (relatively rare) instances
# when a custom built search would be slightly
# faster than a built-in sort method,
# the built-in method is reliably fast and if used with care
# it does not affect seriously the time of the whole code execution.

import random
import time


def demosort( N ):
    a = list( random.choices( range(1, 100), k = N ) )
    t1 = time.time()
    b = sorted( a )
    t2 = time.time()
    print( "Sort N items, N = ", N )
    print("time", "%6.2f" % (t2-t1)  )
    print()




demosort( 10000 )

demosort( 100000 )

demosort( 1000000 )


