/akka-quick-sort-skeleton

Skeleton for an Akka coding dojo

Primary LanguageScala

akka-quick-sort

Skeleton for scalabcn coding-dojo: http://www.meetup.com/Scala-Developers-Barcelona/events/221752186/

Coding Dojo objective

The objective of the coding dojo is to construct a quick sort solution using Akka actors.

Quick Sort Algorithm

The quick sort can be solved as a recursive algorithm that follows this steps:

  1. Take one element of the list as a pivot
  2. Divide the rest of list into two lists:
  • The elements smaller than the pivot
  • The elements greater than the pivot
  1. Recursively follow steps 1. and 2. for the two divided lists.

quicksort animation

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.

Quick Sort using Akka

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!