Skip to content

Commit

Permalink
algo/fix: some issues TA points out
Browse files Browse the repository at this point in the history
  • Loading branch information
tiankaima committed May 31, 2024
1 parent 97dba0f commit 0f08ee4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 7e1810-algo_hw/hw1.typ
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ What is the largest $k$ such that if you can multiply $3 times 3$ matrices using

Assuming $n = 3^m$. Use block matrix multiplication, the recursive running time is $T(n) = k T(n\/3) + O(1)$.

Using master theorem, the largest $k$ to satisfy $log_3 k < lg 7$ is $k=21$.
When $log_3 k > 2 $, using master theorem, the largest $k$ to satisfy $log_3 k < lg 7$ is $k=21$.

]
2 changes: 1 addition & 1 deletion 7e1810-algo_hw/hw9.typ
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $
Explain why the modified algorithm is correct, and explain in what sense this change constitutes an improvement.

#ans[
If $P[q+1]!=T[i] "and" P[pi[q]+q]=P[q+1]!=T[i]$, there's no need to compare $P[pi[q]+q]$ with $T[i]$, because $P[pi[q]+q]$ is the same as $P[q+1]$, so we can directly compare $P[q+1]$ with $T[i]$. This change improves the efficiency of the algorithm.
If $P[q+1]!=T[i] "and" P[pi[q]+1]=P[q+1]!=T[i]$, there's no need to compare $P[pi[q]+1]$ with $T[i]$, because $P[pi[q]+1]$ is the same as $P[q+1]$, so we can directly compare $P[q+1]$ with $T[i]$. This change improves the efficiency of the algorithm.
]

#align(center)[
Expand Down

0 comments on commit 0f08ee4

Please sign in to comment.