listsorted() implemented.

listsorted() implemeneted as well as the compare function used in qsort().