added an if statement that checks if sorted by name

this should output to the binary search method