aboutsummaryrefslogtreecommitdiffstats
path: root/OLD/csci4041/mergeSort_py.py
diff options
context:
space:
mode:
Diffstat (limited to 'OLD/csci4041/mergeSort_py.py')
-rw-r--r--OLD/csci4041/mergeSort_py.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/OLD/csci4041/mergeSort_py.py b/OLD/csci4041/mergeSort_py.py
deleted file mode 100644
index bc9ae7d..0000000
--- a/OLD/csci4041/mergeSort_py.py
+++ /dev/null
@@ -1,30 +0,0 @@
-def head(Q):
- return Q[0]
-def tail(Q):
- return Q[1:]
-def mergesort(U):
- if U == [] or tail(U) == []:
- return U
- else:
- L = []
- R = []
- while U != [] and tail(U) != []:
- L = L+[head(U)]
- U = tail(U)
- R = R+[head(U)]
- U = tail(U)
- L = L + U
- L = mergesort(L)
- R = mergesort(R)
- s = []
- while L != [] and R != []:
- if head(L) <= head(R):
- s = s + [head(L)]
- L = tail(L)
- else:
- s = s + [head(R)]
- R = tail(R)
- s = s + L + R
- return s
-
-print(mergesort([9,3,7,5,6,4,8,2])) \ No newline at end of file