|
6772 | 6772 | <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
|
6773 | 6773 |
|
6774 | 6774 | Last update:
|
6775 |
| - <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="April 22, 2025 01:19:59">April 22, 2025</span>  |
| 6775 | + <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="April 22, 2025 03:58:03">April 22, 2025</span>  |
6776 | 6776 |
|
6777 | 6777 | <!-- Tags -->
|
6778 | 6778 |
|
@@ -6929,7 +6929,17 @@ <h3 id="matrix-form">Matrix form<a class="headerlink" href="#matrix-form" title=
|
6929 | 6929 | F_{n}
|
6930 | 6930 | \end{pmatrix}
|
6931 | 6931 | $$</div>
|
6932 |
| -<p>where <span class="arithmatex">$F_1 = 1, F_0 = 0$</span>.</p> |
| 6932 | +<p>where <span class="arithmatex">$F_1 = 1, F_0 = 0$</span>. |
| 6933 | +In fact, since </p> |
| 6934 | +<div class="arithmatex">$$ |
| 6935 | +\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} |
| 6936 | += \begin{pmatrix} F_2 & F_1 \\ F_1 & F_0 \end{pmatrix} |
| 6937 | +$$</div> |
| 6938 | +<p>we can use the matrix directly:</p> |
| 6939 | +<div class="arithmatex">$$ |
| 6940 | +\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}^n |
| 6941 | += \begin{pmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{pmatrix} |
| 6942 | +$$</div> |
6933 | 6943 | <p>Thus, in order to find <span class="arithmatex">$F_n$</span> in <span class="arithmatex">$O(\log n)$</span> time, we must raise the matrix to n. (See <a href="binary-exp.html">Binary exponentiation</a>)</p>
|
6934 | 6944 | <div class="highlight"><pre><span></span><code><span class="k">struct</span><span class="w"> </span><span class="nc">matrix</span><span class="w"> </span><span class="p">{</span>
|
6935 | 6945 | <span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="n">mat</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">2</span><span class="p">];</span>
|
@@ -7034,7 +7044,7 @@ <h2 id="practice-problems">Practice Problems<a class="headerlink" href="#practic
|
7034 | 7044 |
|
7035 | 7045 | <ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
|
7036 | 7046 | <span class="contributors-text">Contributors:</span>
|
7037 |
| - <ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/gabrielsimoes" title="gabrielsimoes" data-bi-name="contributorprofile" target="_blank">gabrielsimoes</a> (24.64%)</li><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (21.43%)</li><li><a href="#" title="Carlos Javier Blanco" data-bi-name="contributorprofile" target="_blank">Carlos Javier Blanco</a> (16.43%)</li><li><a href="https://github.com/jxu" title="jxu" data-bi-name="contributorprofile" target="_blank">jxu</a> (15.36%)</li><li><a href="https://github.com/madhur4127" title="madhur4127" data-bi-name="contributorprofile" target="_blank">madhur4127</a> (6.43%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (5.36%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (2.5%)</li><li><a href="https://github.com/Morass" title="Morass" data-bi-name="contributorprofile" target="_blank">Morass</a> (2.14%)</li><li><a href="https://github.com/md-shamim-ahmad" title="md-shamim-ahmad" data-bi-name="contributorprofile" target="_blank">md-shamim-ahmad</a> (1.79%)</li><li><a href="https://github.com/boxlesscat" title="boxlesscat" data-bi-name="contributorprofile" target="_blank">boxlesscat</a> (1.07%)</li><li><a href="https://github.com/yeetholmes619" title="yeetholmes619" data-bi-name="contributorprofile" target="_blank">yeetholmes619</a> (1.07%)</li><li><a href="https://github.com/pasthec" title="pasthec" data-bi-name="contributorprofile" target="_blank">pasthec</a> (0.71%)</li><li><a href="https://github.com/mhayter" title="mhayter" data-bi-name="contributorprofile" target="_blank">mhayter</a> (0.36%)</li><li><a href="https://github.com/conlacda" title="conlacda" data-bi-name="contributorprofile" target="_blank">conlacda</a> (0.36%)</li><li><a href="https://github.com/ankit-kumar-dwivedi" title="ankit-kumar-dwivedi" data-bi-name="contributorprofile" target="_blank">ankit-kumar-dwivedi</a> (0.36%)</li></ul> |
| 7047 | + <ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/gabrielsimoes" title="gabrielsimoes" data-bi-name="contributorprofile" target="_blank">gabrielsimoes</a> (23.55%)</li><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (20.48%)</li><li><a href="https://github.com/jxu" title="jxu" data-bi-name="contributorprofile" target="_blank">jxu</a> (18.77%)</li><li><a href="#" title="Carlos Javier Blanco" data-bi-name="contributorprofile" target="_blank">Carlos Javier Blanco</a> (15.7%)</li><li><a href="https://github.com/madhur4127" title="madhur4127" data-bi-name="contributorprofile" target="_blank">madhur4127</a> (6.14%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (5.12%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (2.73%)</li><li><a href="https://github.com/Morass" title="Morass" data-bi-name="contributorprofile" target="_blank">Morass</a> (2.05%)</li><li><a href="https://github.com/md-shamim-ahmad" title="md-shamim-ahmad" data-bi-name="contributorprofile" target="_blank">md-shamim-ahmad</a> (1.71%)</li><li><a href="https://github.com/boxlesscat" title="boxlesscat" data-bi-name="contributorprofile" target="_blank">boxlesscat</a> (1.02%)</li><li><a href="https://github.com/yeetholmes619" title="yeetholmes619" data-bi-name="contributorprofile" target="_blank">yeetholmes619</a> (1.02%)</li><li><a href="https://github.com/pasthec" title="pasthec" data-bi-name="contributorprofile" target="_blank">pasthec</a> (0.68%)</li><li><a href="https://github.com/mhayter" title="mhayter" data-bi-name="contributorprofile" target="_blank">mhayter</a> (0.34%)</li><li><a href="https://github.com/conlacda" title="conlacda" data-bi-name="contributorprofile" target="_blank">conlacda</a> (0.34%)</li><li><a href="https://github.com/ankit-kumar-dwivedi" title="ankit-kumar-dwivedi" data-bi-name="contributorprofile" target="_blank">ankit-kumar-dwivedi</a> (0.34%)</li></ul> |
7038 | 7048 | </ul>
|
7039 | 7049 |
|
7040 | 7050 | </article>
|
|
0 commit comments