aboutsummaryrefslogtreecommitdiff
path: root/sem1/algo/mm3/opgaver.md
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2019-09-18 20:25:09 +0200
committerJulian T <julian@jtle.dk>2019-09-18 20:25:09 +0200
commitc14b6a9b3e2f0a6128750e967c67f8324b46c0d3 (patch)
tree4a3ce656da2a1d7d08993d47dde4ec675a541eba /sem1/algo/mm3/opgaver.md
parentceb14fd5301a7156102b62baa9add6c2beed351a (diff)
Added all school stuff
Diffstat (limited to 'sem1/algo/mm3/opgaver.md')
-rw-r--r--sem1/algo/mm3/opgaver.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/sem1/algo/mm3/opgaver.md b/sem1/algo/mm3/opgaver.md
new file mode 100644
index 0000000..a6e560c
--- /dev/null
+++ b/sem1/algo/mm3/opgaver.md
@@ -0,0 +1,49 @@
+# Opgave 1
+
+## Exercise 9.2
+
+**T(n) = 3T(n/2) + n**
+
+a = 3
+b = 2
+d(n) = n
+
+a ? d(b) -> 3 > 2
+
+Svaret er derfor O(n^log2(3)) = O(n^1.59)
+
+**T(n) = 3T(n/2) + n^2**
+
+3 ? 2^2 -> 3 < 4
+
+d(n) = n^2 hvilket betyder at O(n^2)
+
+**T(n) = 8T(n/2) + n^2**
+
+8 ? 2^3 -> 8 = 8
+
+d(n) = n^3 hvilket betyder at O(n^3 log2(n))
+
+## Evercise 9.3
+
+**T(n) = 4T(n/3) + n**
+
+a = 4
+b = 3
+d(n) = n
+
+4 ? 3 -> 4 > 3
+
+Derfor er svaret O(n^log3(4)) = O(n^1.26)
+
+**T(n) = 4T(n/3) + n^2**
+
+4 ? 3^2 -> 4 < 9
+
+d(n) = n^2 hvilket betyder at O(n^2)
+
+**T(n) = 9T(n/3) + n^2**
+
+9 ? 3^2 -> 9 = 9
+
+d(n) = n^2 hvilket betyder at O(n^2 log2(n))