Jose Sandoval Google
 Resume     Software     Drawings     Home Search Web Search josesandoval.com

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.

Notes:

  1. I've used java.util.Random() to assign a color (from 10) to each ball - You'll see that the # of colored balls is almost the same each time you click the "Reset" button - It's due to the type of probability function used by the randomizer
  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 of where the next group of same colored balls begins

MicrosoftColorSort v1.0



Source Code


Guestbook
Copyright © Jose Sandoval 2007 jose@josesandoval.com