factorial

package
v0.0.0-...-8245ba7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2017 License: MIT Imports: 0 Imported by: 0

README

factorial

$ go test -bench .
BenchmarkLoop-8                 30000000                44.1 ns/op
BenchmarkRecursion-8             5000000               278 ns/op
BenchmarkTailRecursion-8         5000000               253 ns/op
PASS
ok      github.com/phedoreanu/go-playground/factorial   4.628s

$ gocyclo -top 3 -avg .
2 factorial Recursion factorial.go:17:1
2 factorial Loop factorial.go:9:1
2 factorial TailRecursion factorial.go:24:1
Average: 1.29
$ mccabe-cyclomatic -p github.com/phedoreanu/go-playground/factorial
4

Documentation

Overview

Example
package main

import (
	"fmt"

	"github.com/phedoreanu/go-playground/factorial"
)

func main() {
	fmt.Println(factorial.Solution(0))
}
Output:

1

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loop

func Loop(n uint64) (x uint64)

func Recursion

func Recursion(n uint64) uint64

func Solution

func Solution(n uint64) uint64

func TailRecursion

func TailRecursion(n, t uint64) uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL