Zebra0.com

algorithms salt-pepperSalt and Pepper Algorithm

Salt and Pepper Algorithm

Salt and Pepper

In the illustration, the salt and pepper are in the wrong containers. The pepper is in the jar that says "Salt" and the salt is in the jar that says "Pepper."

salt and pepper reversedHow would you fix this problem?

Fortunately, there is an empty jar available.

Try this on paper before you look at the solution.