Searching and Sorting algorithms in Python