diff options
Diffstat (limited to 'insertion-sort.py')
-rwxr-xr-x | insertion-sort.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/insertion-sort.py b/insertion-sort.py index 350c88b..dfb7900 100755 --- a/insertion-sort.py +++ b/insertion-sort.py @@ -1,10 +1,17 @@ #!/bin/python3 +# --------- Insertion sort + +# --------- Imported modules import inputoutput as io import csv import sys +# ingressing +target = sys.argv[1] +numdata = io.ingressCSV(target) + # insertion sort algorithm, as function def insertionSort(data): for i in range(1, len(data)): @@ -19,9 +26,15 @@ def insertionSort(data): # move key after element smaller than it data[j + 1] = key -testarr = [99,77,44,22,11,33] -print(testarr) -insertionSort(testarr) +#testarr = [99,77,44,22,11,33] +#print(testarr) +#insertionSort(testarr) #FIXME: no return argument needed! +#print(testarr) + +# sorting call +insertionSort(numdata) -print(testarr) +# wrapping up +print("Sorting done! Writing to file.") +io.egressCSV(numdata,target) |