The problem of the Dutch national flag involves starting out with a row of n buckets, i.e. bucket [1..n], each bucket containing a single pebble that is either red, white or blue.
The task is to arrange the pebbles so that all reds occur before all whites which in turn occur before all blue pebbles. Design and implement an algorithm to solve the Dutch national flag problem.