Hi All,
Here's the first hint for the my_sort assignment.
To swap 2 elements in an array -- say the 3rd element and the 2nd element -- you'd do this:
a = [1, 2, 3]
a[2], a[1] = a[1], a[2]
puts a.inspect # [1, 3, 2]
Look for the 2nd hint tomorrow or Saturday.
Glenn
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment