If two different patterns have the same frequency and the latter is among the k highest, include them both.
Say we want to print the two highest frequencies, and our two highest frequencies are 5 and 2, but there are multiple keys with the value of 2. Our function will only print one when it needs to print all keys with that value.
Say we want to print the two highest frequencies, and our two highest frequencies are 5 and 2, but there are multiple keys with the value of 2. Our function will only print one when it needs to print all keys with that value.