Skip to content

Instantly share code, notes, and snippets.

@hkaya15
Created June 25, 2022 23:40
Show Gist options
  • Save hkaya15/61cedfb6a3ec796a8f91649639b34320 to your computer and use it in GitHub Desktop.
Save hkaya15/61cedfb6a3ec796a8f91649639b34320 to your computer and use it in GitHub Desktop.
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