www.habanero-marketing.com / HQ: Ashland
krishimaratavahini.kar.nic.in / HQ: Bangalore
You have an array randomly filled with red, blue and green items. How do you order this list so the red items are at the beginning, followed by the blue ones, followed by the green ones? The algorithm should be in-place (no extra storage, or only constant extra storage) and the algorithm should only walk threw the array once (every position can only be read once).