bart
bart

Reputation: 21

Sorting Algorithms compared to one another

This link is the image to the graph comparing the sorting algorithms and I am a bit confused as to how I could interpret it/compare the different algorithms into words.

https://i.sstatic.net/zAQwV.png

Upvotes: 1

Views: 61

Answers (1)

Marcel
Marcel

Reputation: 1048

The x-axis represents the size of the list that's being sorted, and the y-axis the amount of time it took to sort that list. Each line corresponds to a sorting algorithm.

In terms of interpretation, you can see for example that for small list sizes, quicksort is the slowest sorting method. When you make the size bigger, it becomes relatively faster than a lot of the other methods.

This difference is because quicksort has a larger "overhead" (the amount of time you need regardless of the list size) than most of the methods, but a better algorithmic complexity (the way the time scales with increasing list sizes when the size is already large). The algorithmic complexity can be measured by looking at the slope of the lines for large list sizes, because this is a log-log plot.

Timsort is better than the other methods for all list sizes because it's designed to pick different methods depending on specifics of the list.

Upvotes: 5

Related Questions