Jose Sandoval Google
 Resume     Book     Software     Drawings     Home Search Web Search

Microsoft's programming problem

You should read the background story before continuing. Or you could choose to just continue, but I think the blog entry may give you a bit of the background as to why I've coded such useless applet.

Color sorting array of N balls, and each ball could have a color from a set of M colors.


  1. I've used java.util.Random() to assign a color (from 10) to each ball.
  2. Click the "Reset" button to randomize
  3. Click the "Sort" button to sort
  4. There are a couple of Thread.sleep() calls, so you can see how the sorting is taking place
  5. There are 25 columns and 24 rows (600 balls)
  6. The indices given on the right are the indices within the 2D array where the next group of same colored balls begins

MicrosoftColorSort v1.0

Source Code

© Jose Sandoval 2004-2009