(inputArray)
| 29 | return outputArray |
| 30 | |
| 31 | def radixSort(inputArray): |
| 32 | # Step 1 -> Find the maximum element in the input array |
| 33 | maxEl = max(inputArray) |
| 34 | |
| 35 | # Step 2 -> Find the number of digits in the `max` element |
| 36 | D = 1 |
| 37 | while maxEl > 0: |
| 38 | maxEl /= 10 |
| 39 | D += 1 |
| 40 | |
| 41 | # Step 3 -> Initialize the place value to the least significant place |
| 42 | placeVal = 1 |
| 43 | |
| 44 | # Step 4 |
| 45 | outputArray = inputArray |
| 46 | while D > 0: |
| 47 | outputArray = countingSortForRadix(outputArray, placeVal) |
| 48 | placeVal *= 10 |
| 49 | D -= 1 |
| 50 | |
| 51 | return outputArray |
| 52 | |
| 53 | input = [2,20,61,997,1,619] |
| 54 | print(input) |
no test coverage detected