diff options
author | internetlandlord <f.fredhenry@gmail.com> | 2022-10-20 22:55:41 +0000 |
---|---|---|
committer | internetlandlord <f.fredhenry@gmail.com> | 2022-10-20 22:55:41 +0000 |
commit | 61137618fcce80aeccd94098be3fab61be551d8e (patch) | |
tree | 93c1da4d482ba30ac03ca4a95b0a94fcc000bf4e | |
parent | d6a2194fd59447e3b0aef92d065e522e2ddaf50d (diff) |
Completed file i/o functionality in insertion sort script.
-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) |