+ 2
About sort method
I want to know why following 2 ways to use sort method can reverse the elements in the array "a". a = (1..100).to_a (1) a2 = a.sort{|n1, n2| n2 <=> n1 } p a2 (2) a3 = a.sort_by{|i| -i } p a3 Thank u for ur helping.
1 Resposta
+ 2
start with shell and bubble sort algoritms