added ruby implementation of 1, ruby and c of 2, c of 3