for all things technical

Ruby vs. Java in Solving the Perfect Shuffle Problem, Part 1 of 3

Introduction

I once read a comparison of Java and Ruby that said, “Ruby is terse, Java is not.” And that was it.

OK thanks. I’ve read equally uninformative statements about English and Japanese. Such generalizations do not answer my main concern as a developer, which is why and when to use either language.

A more educational way to compare the two languages is to write a Java and Ruby program to solve the same challenging problem. Ideally, the problem’s solution would be relatively short.

Therefore, in part 2 of this article I describe the Perfect Shuffle Problem, and how to solve it without using brute force. I follow this up in part 3 by presenting both a Java and Ruby based solution.

If you are impatient to get to the comparison, feel free to skip to Part 3.

Next: The Perfect Shuffle Problem


Leave a Reply