comparator for frequencyTable