String search and string sort algorithms written in python