Disambiguator calculateAffinity O(n log n) to O(n)