Here is a great algorithm for solving Rubik's cube. Some times you don't have to go through all the way to the end. If it doesn't finished, continue from the beginning; it will finish eventually.
24 step algorithm
L | R2 | B | L' | R | U2 |
F2 | L | B | D | U2 | B |
L' | R2 | B2 | L' | D2 | U |
L | B2 | U2 | R2 | B | D2 |