diff options
author | internetlandlord <f.fredhenry@gmail.com> | 2022-10-31 13:52:22 -0500 |
---|---|---|
committer | internetlandlord <f.fredhenry@gmail.com> | 2022-10-31 13:52:22 -0500 |
commit | b8a2b8d9aee28d5ef1753d8ebdfea480b9603c48 (patch) | |
tree | e220db1b7610a61fff8c7aeff01795a68b45c31a | |
parent | 7ccfafb0c07b38524270ebcd61ed03984332ab5a (diff) |
Re-configured inputoutput to remove appending in egress function. Add appending to each algorithm script to denote sorting job performed
-rwxr-xr-x | bubble-sort.py | 3 | ||||
-rwxr-xr-x | heap-sort.py | 3 | ||||
-rwxr-xr-x | inputoutput.py | 2 | ||||
-rwxr-xr-x | insertion-sort.py | 3 | ||||
-rwxr-xr-x | merge-sort.py | 3 | ||||
-rwxr-xr-x | quick-sort.py | 3 |
6 files changed, 11 insertions, 6 deletions
diff --git a/bubble-sort.py b/bubble-sort.py index ac7237c..10c7af0 100755 --- a/bubble-sort.py +++ b/bubble-sort.py @@ -24,6 +24,7 @@ for i in range(len(numdata)): if numdata[j] > numdata[j+1]: numdata[j], numdata[j+1] = numdata[j+1], numdata[j] -# finishing up +# finishing up, appending "-bubblesorted" to CSV +target = target[:-4]+"-bubblesorted"+target[-4:] print("Sorting complete! Writing to file.") io.egressCSV(numdata,target) diff --git a/heap-sort.py b/heap-sort.py index c8a45eb..8bb4189 100755 --- a/heap-sort.py +++ b/heap-sort.py @@ -58,6 +58,7 @@ def heapSort(atad): # using sorting algorithm heapSort(numdata) -# finishing up +# finishing up, appending "-heapsorted" to sorted CSV +target = target[:-4]+"-heapsorted"+target[-4:] print("Sorting done! Writing to file") io.egressCSV(numdata,target) diff --git a/inputoutput.py b/inputoutput.py index dd20da6..f1a7c91 100755 --- a/inputoutput.py +++ b/inputoutput.py @@ -31,7 +31,7 @@ def ingressCSV(location): def egressCSV(row,location): # create a new file with -sorted - location = location[:-4]+"-sorted"+location[-4:] + # location = location[:-4]+"-sorted"+location[-4:] # open file to write f = open(location,'w') diff --git a/insertion-sort.py b/insertion-sort.py index 41a07da..6aa620a 100755 --- a/insertion-sort.py +++ b/insertion-sort.py @@ -30,6 +30,7 @@ def insertionSort(data): # sorting call insertionSort(numdata) -# wrapping up +# wrapping up and appending "-insertionsorted" to CSV +target = target[:-4]+"-insertionsorted"+target[-4:] print("Sorting done! Writing to file.") io.egressCSV(numdata,target) diff --git a/merge-sort.py b/merge-sort.py index 683af05..2464e03 100755 --- a/merge-sort.py +++ b/merge-sort.py @@ -56,6 +56,7 @@ def mergeSort(data): # calling the function mergeSort(numdata) -# finishing up and egress of data +# finishing up and appending "-mergesorted" to CSV +target = target[:-4]+"-mergesorted"+target[-4:] print("Sorting done, writing to file!") io.egressCSV(numdata,target) diff --git a/quick-sort.py b/quick-sort.py index 1f807dd..13ab061 100755 --- a/quick-sort.py +++ b/quick-sort.py @@ -38,6 +38,7 @@ def quickSort(data): # running quicksort against the ingressed data numdata = quickSort(numdata) -# finishing up +# finishing up and appending "-quicksorted" to CSV +target = target[:-4]+"-quicksorted"+target[-4:] print("Sort complete, writing to file!") io.egressCSV(numdata,target) |