Algorithmic Complexity/Examples

From ProofWiki
Jump to navigation Jump to search

Examples of Algorithmic Complexity

Multiplication of Square Matrices

Consider two square matrices $\mathbf A$ and $\mathbf B$ of order $n$.

Consider the matrix multiplication operation:

$\ds \mathbf A \times \mathbf B := \forall i j \in \closedint 1 n: c_{i j} = \sum_{k \mathop = 1}^n a_{i k} \circ b_{k j}$

This takes $2 n^3$ steps when using the usual method.


However, using the Strassen algorithm, this takes a number of steps proportional to $n^{\lg 7}$, where $\lg$ denotes logarithm base $2$.

As $\lg 7 < 3$, it follows that the Strassen algorithm uses fewer steps than the usual method, for sufficiently large $n$.