aboutsummaryrefslogtreecommitdiffstats
path: root/csci4041/TEST.py
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2020-01-31 11:48:53 -0600
committerMatthew Strapp <msattr@gmail.com>2020-01-31 11:48:53 -0600
commita0c4143cbda786895a9735bdbf545df5006942e8 (patch)
tree5782c7b252311258465d5e44c2e3cb756da9fdc8 /csci4041/TEST.py
parentR E A R R A N G E (diff)
downloadhomework-a0c4143cbda786895a9735bdbf545df5006942e8.tar
homework-a0c4143cbda786895a9735bdbf545df5006942e8.tar.gz
homework-a0c4143cbda786895a9735bdbf545df5006942e8.tar.bz2
homework-a0c4143cbda786895a9735bdbf545df5006942e8.tar.lz
homework-a0c4143cbda786895a9735bdbf545df5006942e8.tar.xz
homework-a0c4143cbda786895a9735bdbf545df5006942e8.tar.zst
homework-a0c4143cbda786895a9735bdbf545df5006942e8.zip
Rename file
Diffstat (limited to 'csci4041/TEST.py')
-rw-r--r--csci4041/TEST.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/csci4041/TEST.py b/csci4041/TEST.py
deleted file mode 100644
index bc9ae7d..0000000
--- a/csci4041/TEST.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