-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,155 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% extends "!layout.html" %} | ||
{% block extrahead %} | ||
<link href="{{ pathto("_static/custom.css", True) }}" rel="stylesheet" type="text/css"> | ||
{% endblock %} |
Submodule figures
updated
41 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
#include <stdbool.h> | ||
|
||
#define SIZE 1000 | ||
|
||
bool cache_input[SIZE] = { false }; | ||
int cache_output[SIZE]; | ||
|
||
int memoize(int input, int output) { | ||
cache_input[input % SIZE] = true; | ||
cache_output[input % SIZE] = output; | ||
return output; | ||
} | ||
|
||
bool memoize_has(int input) { | ||
return cache_input[input % SIZE]; | ||
} | ||
|
||
int memoize_get(int input) { | ||
return cache_output[input % SIZE]; | ||
} | ||
|
||
int fib(int n) | ||
{ | ||
if (memoize_has(n)) return memoize_get(n); | ||
if (n < 2) return 1; | ||
return memoize(n, fib(n - 1) + fib(n - 2)); | ||
} | ||
|
||
int main() { | ||
for (int i = 0; i < 40; i++) { | ||
printf("%d\n", fib(i)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.