Digital Sorting Algorithm