Alter it how? Why can't you just use the same sorting algorithm and change every BLUE with a GREEN and vice versa?