Created
June 25, 2022 23:40
-
-
Save hkaya15/61cedfb6a3ec796a8f91649639b34320 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package main | |
import "testing" | |
func Benchmark_tabulation_stairs(b *testing.B) { | |
n := 1000 | |
b.ReportAllocs() | |
b.ResetTimer() | |
for i := 0; i < b.N; i++ { | |
tabulation_getminstairs(n) | |
} | |
} | |
func Benchmark_memoization_stairs(b *testing.B) { | |
n := 1000 | |
memo := make([]int,n+1) | |
b.ReportAllocs() | |
b.ResetTimer() | |
for i := 0; i < b.N; i++ { | |
memoization_getminstairs(n,memo) | |
} | |
} | |
func Benchmark_recursive_stairs(b *testing.B) { | |
n := 1000 | |
b.ReportAllocs() | |
b.ResetTimer() | |
for i := 0; i < b.N; i++ { | |
recursive_getminstairs(n) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment