You will apply standard algorithms for searching through data and sorting it into order.
Apply common search, and sort algorithms.