+ 3
Why do we need sorting algorithms
a lot of emphasis is placed on sorting algorithms although, I still wondering why it is needed as most languages provide a function or method to sort a list of arrays
6 Answers
+ 4
take for example your desk. if everything on your desk would be messy (unsorted), your work speed will decrease a lot and it will be hard to locate some items. but if everything is on the right place your job is much easier.
+ 4
that's a good point. i think if language has some sorting functions then yeah, it's better to use them to save time and fingers. but it's still good to know how sorting algorithm works, what type of sorting algorithms we have etc.
+ 3
I'll add my penny. Sorting problem is very good practical and well defined problem to polish developer skills. Numeric array in RAM sorting is very simple case. What if
- array doesn't fit in memory
- distributed across multiple locations
- ordering criteria hard to calculate
- huge array is 'partially' ordered
- etc.
This is really Pandora box...
+ 2
that's a fair answer @Roabs but don't you think a lot of languages provide sorting functions on all there list variables like arrays and maps, so why reinvent the wheel
+ 1
what do you think how these provided sorting functions/methods sorts your data? by magic? no it uses these sorting algorithms.