CS 101: December 2012

HW #4: Mars Aliens

Lab Questions
1. For finding the aliens, I used an algorithm to find which rows and columns where there was significantly more green than any other color in the pixels.
2. In my class, the data members are total width and total height, whereas the functions are to find the size, location, and the method of finding the alien.
3. My object recognition was based on the colors of the RGB values, and if green was significantly larger, the alien would be recognized.
4. I tested my algorithm with the first picture because it was the easiest one (just one alien).
5. To sort the aliens by size, I used selection sort. It runs through the program and switches the value of the smallest with the first value.
6. (see #5)
7. The Big O of my sorting algorithm is n^2
Click here to download the code for this program! (Right-click and Save As)

Back to Homepage

Valid XHTML 1.0 Transitional!Valid CSS!