Searching and Sorting Algorithms in Ruby