Today's algorithm class is not high-energy, the teaching assistants all kinds of worship ~ ~ Here to talk about the brazen, of course, plagiarism, hiahia~~
1. Divide and Conquer
First of all, mention this high-energy problem, have to say that the master theory, is simply plug-in, BUG ...
$ $T (n) = at (n/b) + f (n); \text{assuming} n = b^x$$
$ $T (n) = \underbrace{\theta (N^{\log_b a})}_{\text{solving base cases}}+\underbrace{\sum\limits_{j=0}^{(\log_b N) -1}a ^j f\left (\frac{n}{b^j}\right)}_{g (n) =\text{dividing and combining}}$$
Case 1: $f (n) = O (N^{\log_b A-\varepsilon}) $:
$g (n) = O (N^{\log_b a}); T (n) = \theta (N^{\log_b a}) $
Case 2: $f (n) = \theta (N^{\log_b A}) $:
$g (n) = N^{\log_b A} \log_b N; T (n) = \theta (N^{\log_b a}) \log_b n$
Case 3: $f (n) = \omega (N^{\log_b A+\varepsilon}) $:
$g (n) = \theta (f (n)); T (n) = \theta (f (n)) $
With this tool, we can use a certain skill to solve the problem ~ ~
problem 1: Multiplication of n-bit integers (hello, we're talking about binary AH ~ ~)
In fact, our elementary school mathematics teaches the column vertical method, must first calculate 1-bit times N-bit, then also must carry on the shift, finally adds, the notice we define here Elementary options is two n-bit number of addition is $o (n) $,1- Bit times N-bit is $o (1) $, the shift operation is also $o (1) $, so there is a total of $n$ multiplication, about $n$ times shift, and finally the addition of $n$ times, since the addition itself is already $o (n) $, so the total complexity reaches $o (n^2) $. We've been doing this for many years, and it's no good, and it seems that some people once thought that the lower bound of n-bit integer multiplication was $\omega (n^2) $.
By the year 1960, a new algorithm was proposed, the complexity reduced to $o (n^{1.59}) $, in fact, you found that is $o (n^{\log_2 3}) $, and then you look at the master Thm, can also come out ~ ~ First, we do the sub-operation:
$ $x =x_l|x_r=x^{n/2}x_l+x_r$$
$ $y =y_l|y_r=y^{n/2}y_l+y_r$$
$ $xy = (X^{n/2}x_l+x_r) (Y^{n/2}y_l+y_r) $$
$ $xy =2^NX_LY_L+2^{N/2} (x_ly_r+x_ry_l) +x_ry_r$$
However, the result is that the final problem is reduced by half, but we need to solve 4 such sub-problems, and then there are $n+n/2$ secondary shift operations, the resulting recursion:
$ $T (n) =4t (N/2) +\theta (n) =\theta (n^2) $$
Actually did not improve!! All right, try to figure it out!
$$ (X_l+x_r) (y_l+y_r) = x_ly_l+ (X_ly_r + x_ry_l) + x_ry_r$$
We may as well write as $p_0=p_1+p_2+p_3$, here the $p_1,p_2,p_3$ are we to calculate in the process above, by calculating $ (x_l+x_r) (Y_l+y_r) $, the cost of $o (n) $, the original 4 sub-problem reduced to 3, recursive:
$ $T (n) =3t (N/2) +\theta (n) =\theta (n^{\log_2 3}) $$
problem 2: Matrix multiplication
The matrices defined here are $n\times n$ matrices, which specify elementary Operations, addition and multiplication complexity between two elements are $o (1) $
In this way, for the $n^2$ elements of the result, each need to do $n$ and $n$ multiplication, so the total complexity is $o (n^3) $,oh No, which is scary!
Think of recursion, what if we were to block the matrix like the integer multiplication above?
$ $X =\left[
\BEGIN{ARRAY}{C|C}
A & B \\\hline
C & D \ \
\end{array}
\right],\quad y=\left[
\BEGIN{ARRAY}{C|C}
E & F \ \hline
G & H \ \
\end{array}
\right]$$
So
$ $XY =\left[
\BEGIN{ARRAY}{C|C}
AE+BG & AF+BH \\\hline
CE+DG & CF+DH \ \
\end{array}
\right]$$
The complexity of the combine is mainly embodied in the addition of the Matrix, the number of $\dfrac{n}{2}\times\dfrac{n}{2}$ added, the complexity of $\theta (n^2) $, let's look at the recursive
$ $T (n) =8t (N/2) +\theta (n^2) =\theta (n^3) $$
Still hasn't changed!! Of course, we can continue to use problem 1 in the technique (Strassen algorithm), can be reduced to just 7 size for the $n/2$ sub-problem, the final $ $T (n) =\theta (n^{\log_2 7}) =\theta (n^2.808) $ $
The good news is that, in 2014, the complexity of the matrix multiplication problem has dropped to $\theta (n^{2.373}) $, gratifying to congratulate! The lower bound of the problem is just $\omega (n^2) $
2. amortized analysis
3. Adversary Argument
[Algorithm tutorial] divide and conquer, split, opponent argument