Skip to content

mzubal/josephus-problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Josephus Problem Solver (Scala)

This is a sample application solving the Josephus Problem (https://en.wikipedia.org/wiki/Josephus_problem). The solution uses circular buffer based on mutable ArrayBuffer and index. I have originally used immutable IndexedSeq, but later switched to ArrayBuffer for performance reasons. The application uses Scalatest and scala-logging backed with logback.

Running the Application

The application requires SBT (http://www.scala-sbt.org/) to be installed locally. Run the application from command line or shell:

sbt "run 3 2"

Running the Tests

sbt test

Enabling detailed logging

  • Edit src/main/resources/logback.xml
  • Change line <root level="info"> to <root level="debug">
  • Run the application and observe logs in console and in josephus-solver.log

About

Sample solution of the Josephus Problem in Scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages