Chapter 13. Sorting

In a chaotic environment, we look for events that are ordered and follow some rules in order to understand them. An ordered environment also helps in searching and choosing elements according to our requirements for a specific purpose.

Sorting can be in an increasing order (not decreasing when the data list has duplicate elements), and it can be in a decreasing order too. Remember the queue of students in school in the increasing order of height in parades, sorting a deck of cards to get the required card in a shorter time while playing cards?

A sorting algorithm arranges the elements of a collection in some order, generally, in either increasing or decreasing order. A sorting algorithm requires the comparison of elements and ...

Get Learning Functional Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.