0.3.10 The nth Largest
The problem of finding the nth-largest (or smallest) item in a set is
closely related to the process of sorting. Indeed one way to
accomplish this goal is to sort the list and then count off until
reaching the item desired. However, as we will see, this is a waste
of time as there are many algorithms specifically designed to find
nth-largest items faster than the time required to sort and count.
|