Created
December 9, 2020 11:34
-
-
Save teyyihan/adee9dcee5070e6c43744e50ed78cb58 to your computer and use it in GitHub Desktop.
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
func main() { | |
d := make(map[int]int) | |
t0 := time.Now() | |
fmt.Println(fib(40)) | |
t1 := time.Now() | |
fmt.Println(memoFib(40,d)) | |
t2 := time.Now() | |
fmt.Println("It took ",t1.Sub(t0).Nanoseconds()," nanoseconds to calculate without memoization") | |
fmt.Println("It took ",t2.Sub(t1).Nanoseconds()," nanoseconds to calculate with memoization") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment