josephus

command module
v0.0.0-...-5c60df6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2016 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

josephus

A sample implementation of Josephus problem in golang with tests.

To run the tests and benchmark, execute:

go test github.com/ParthDesai/josephus/lastalive

go test github.com/ParthDesai/josephus/simulator

How to compile/Run this program:

Pre-requisites: Golang programming environment GOPATH and GOBIN environment variables correctly set.

Steps to compile the program:

  1. Use go get to retrieve project from github. go get github.com/ParthDesai/josephus

  2. Use go install to build the project. go install github.com/ParthDesai/josephus

This program accepts one command line argument, N which indicates total number of person standing in a circle.

Go to $GOBIN.

Documentation

Overview

This is in-efficient implementation of Josephus problem. There is a straightforward equation to solve the problem, But It would be unfair, so I have implemented a algorithm that will compute the answer recursively.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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