Skeleton for scalabcn coding-dojo: http://www.meetup.com/Scala-Developers-Barcelona/events/221752186/
The objective of the coding dojo is to construct a quick sort solution using Akka actors.
The quick sort can be solved as a recursive algorithm that follows this steps:
- Take one element of the list as a
pivot
- Divide the rest of list into two lists:
- The elements smaller than the pivot
- The elements greater than the pivot
- Recursively follow steps 1. and 2. for the two divided lists.
- Image from Wikipedia
At each step the processed list is at least 1 element smaller (the pivot). This is the condition of termination of this algorithm.
When sorting an empty list or a list with one element it returns the input value.
When it receives the result of the two recurive calls, it returns the smaller list concatenated with the pivot and the greater list.
The idea is to construct the algorithm using an Akka Actor
to resolve each step, creating two new actors to resolve the to sub-lists.
This algorithm will create a binary tree of actors. No optimizations are considered for this coding dojo.
Have fun!