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
def better_fib(n): | |
if n >= 0 and n <= 1: | |
return n | |
else: | |
fib = [0, 1] | |
for i in range(2, n + 1): | |
fib.append(fib[i - 1] + fib[i - 2]) | |
return fib[n] |
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
def naive_fib(n): | |
if n >= 0 and n <= 1: | |
return n | |
else: | |
return naive_fib(n - 1) + naive_fib(n - 2) |
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
global start | |
section .text | |
bits 32 | |
start: | |
; point the first entry of the level 4 page table | |
; to the first entry in level 3 page table | |
mov eax, p3_table | |
or eax, 0b11 | |
mov dword [p4_table + 0], eax |
NewerOlder