aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2024-11-25 20:38:03 +0200
committerZhongheng Liu <z.liu@outlook.com.gr>2024-11-25 20:38:03 +0200
commit4531afb7137e85dbdc45ec9147612a101568a507 (patch)
tree473fcf5b2e0ab7b1852ca7749b91231d797e2e73
parent5df83b0e15a757b4803b66b9af6a7e5afcd1667e (diff)
downloadcs-y13-4531afb7137e85dbdc45ec9147612a101568a507.tar.gz
cs-y13-4531afb7137e85dbdc45ec9147612a101568a507.tar.bz2
cs-y13-4531afb7137e85dbdc45ec9147612a101568a507.zip
chore: move and rename
-rw-r--r--adt-queue/queue.py (renamed from queue.py)0
-rw-r--r--adt-stack/stack.py (renamed from lesson4.py)0
-rw-r--r--algorithms/binary_sort.py (renamed from lesson1.py)6
-rw-r--r--algorithms/bubble_sort.py (renamed from lesson2.py)0
-rw-r--r--algorithms/linear_search.py (renamed from lesson3.py)0
-rw-r--r--dictionaries/dicts.py15
-rw-r--r--linked_list/linked.py (renamed from linked.py)0
-rw-r--r--linked_list/linked_list.py28
8 files changed, 19 insertions, 30 deletions
diff --git a/queue.py b/adt-queue/queue.py
index 4235a7f..4235a7f 100644
--- a/queue.py
+++ b/adt-queue/queue.py
diff --git a/lesson4.py b/adt-stack/stack.py
index e99f231..e99f231 100644
--- a/lesson4.py
+++ b/adt-stack/stack.py
diff --git a/lesson1.py b/algorithms/binary_sort.py
index 052ec27..2e71b52 100644
--- a/lesson1.py
+++ b/algorithms/binary_sort.py
@@ -2,9 +2,9 @@ import random
def generate_test_data(length: int, _range: tuple):
arr = []
for i in range(length):
- arr.append(random.randint(_range[0], _range[1]))
+ arr.append(random.randint(int(_range[0]), int(_range[1])))
return arr
-def binsearch(arr: list, item):
+def binsearch(arr, item):
arr = sorted(arr)
print(arr)
ubound, lbound = len(arr) - 1, 0
@@ -70,4 +70,4 @@ def main():
print("Not found.")
test_existsness(100)
if __name__ == "__main__":
- main() \ No newline at end of file
+ main()
diff --git a/lesson2.py b/algorithms/bubble_sort.py
index f77ea08..f77ea08 100644
--- a/lesson2.py
+++ b/algorithms/bubble_sort.py
diff --git a/lesson3.py b/algorithms/linear_search.py
index 5a54ce6..5a54ce6 100644
--- a/lesson3.py
+++ b/algorithms/linear_search.py
diff --git a/dictionaries/dicts.py b/dictionaries/dicts.py
new file mode 100644
index 0000000..47a79e8
--- /dev/null
+++ b/dictionaries/dicts.py
@@ -0,0 +1,15 @@
+# Activity 19P
+
+TEST_CLASS_EXAM_DATA = {
+ "Justin": 0,
+ "Kim Jong Un": 69,
+ "Kim Il-Sung": 150,
+}
+
+print(TEST_CLASS_EXAM_DATA["Justin"])
+
+TEST_CLASS_EXAM_DATA["Skibidi Rizzler"] = 66
+
+del TEST_CLASS_EXAM_DATA["Justin"]
+
+print(TEST_CLASS_EXAM_DATA)
diff --git a/linked.py b/linked_list/linked.py
index cd5d36e..cd5d36e 100644
--- a/linked.py
+++ b/linked_list/linked.py
diff --git a/linked_list/linked_list.py b/linked_list/linked_list.py
index f109777..4c07536 100644
--- a/linked_list/linked_list.py
+++ b/linked_list/linked_list.py
@@ -33,30 +33,4 @@ names = [
for name in names:
new_list.insert(name)
new_list.visualise()
-"""names = []
-ptrs = []
-l = 10
-for i in range(10):
- names.append(None)
- ptrs.append(i+1)
-ptrs[9] = -1
-sp = -1
-fp = 0
-print(names)
-print(ptrs)
-def insert_one(name):
- global sp
- global fp
- global ptrs
- global names
- if fp == -1:
- print("Not free")
- return
- names[fp] = name
- ptrs[fp] = sp
- sp = fp
- fp = ptrs[fp]
- print(names)
- print(ptrs)
-insert_one("Steven")
-insert_one("Steven2")"""
+