Linear Time Sorting Algorithm In Python