Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 57 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,6 @@ Com o objetivo de alcançar uma abrangência maior e encorajar mais pessoas a co
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- JavaScript -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this <td>?

<td> <!-- Swift -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
Expand Down Expand Up @@ -993,6 +988,63 @@ Com o objetivo de alcançar uma abrangência maior e encorajar mais pessoas a co
</td>
</tr>
<tr>
<td><a href="https://www.ime.usp.br/~pf/algoritmos/aulas/recu.html">Fibonacci Memoization</a></td>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<td><a href="https://www.ime.usp.br/~pf/algoritmos/aulas/recu.html">Fibonacci Memoization</a></td>
<td><a href="https://en.wikipedia.org/wiki/Fibonacci_sequence">Fibonacci (Memoization)</a></td>
<td> <!-- C -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- C++ -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Java -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Python -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Go -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Ruby -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!--JavaScript-->
<a href="./src/javascript/FibonacciMemoization.js">
<img align="center" height="25" src="./logos/javascript.svg" />
</a>
</td>
<td> <!-- Swift -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Rust -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Scala -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
<td> <!-- Kotlin -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
</a>
</td>
</tr>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is wrong, I believe you should add 4 spaces.

<td><a href="https://www.ime.usp.br/~pf/algoritmos/aulas/recu.html">Máximo Recursivo</a></td>
<td> <!-- C -->
<a href="./src/c/MaxRecursivo.c">
Expand Down
14 changes: 14 additions & 0 deletions src/javascript/FibonacciMemoization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* A memoização é uma abordagem que podemos usar para escrever a função fibonacci. Resumindo é uma técnica de otimização em que amarzenamos os valores de resultados anteriores, de modo semelhante a um cache.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please translate it to english?

*
* @param {number} n
*/
function fibonacciMemoization(n) {
const memo = [0, 1];
const fibonacci = (n) => {
if(memo[n] != null) return memo[n];
return memo[n] = fibonacci(n - 1, memo) + fibonacci(n - 2, memo)
};

return fibonacci;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a main function to validate/exemplify the solution?