Searching and sorting algorithms homework