diff options
author | Julian T <julian@jtle.dk> | 2020-02-11 12:24:56 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-02-11 12:24:56 +0100 |
commit | 6db1a2cdd3b96731f2e092d55d8c2136eabc52d0 (patch) | |
tree | 2be8fae8ce82d708ed9f00f376dda14420850e80 /sem3/algo/mm3/opgaver.md | |
parent | 57305119e05559c1c37e903aef89cd43f44c42c9 (diff) |
Rename and cleanup
Diffstat (limited to 'sem3/algo/mm3/opgaver.md')
-rw-r--r-- | sem3/algo/mm3/opgaver.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sem3/algo/mm3/opgaver.md b/sem3/algo/mm3/opgaver.md new file mode 100644 index 0000000..a6e560c --- /dev/null +++ b/sem3/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)) |