Thoughtworks logo

What's the difference between a.sort and a.sort! ?

To sort an array a in Ruby, you could either do a.sort or a.sort! . What's the difference between the two? Discuss performance and end result. How would you use them? Provide one example where a.sort is better than a.sort! and one example where a.sort! is better than a.sort.

$75
top 5
25
submissions
DONE
44 months ago
Small pic thoughtworks challenge
Deliverables

Leaderboard
This challenge has received 24 submissions
Top 5 share $75
$15.00 S Rochester Institute of Technology
$15.00 Square pic 0203152114 New York University
$15.00 Square pic profile San Francisco State University
$15.00 J University of California at Berkeley
Contact Us!
Write for our Blog to share your thoughts, ideas and stories with 300,000 peers