A Note About Efficiencies
Efficiency may or may not be something you have thought about as you've scripted or written applications. However, I bet if you were to write anything that scaled, or could be expanded, efficiency would become important. Honestly, you could use any of the algorithms presented in this chapter to sort an array of 10 elements, and you wouldn't notice a bit of performance difference. What about if you start sorting arrays of 10,000 elements? 100,000 elements? The performance issue will become a bit more noticeable. The situation and context of the script you're writing should determine the best sorting algorithm to use. Experience will give you more insight into the best tool to accomplish the job.
While on the topic of efficiency, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access