Added compare methods for triples and a binary search