Priority queue of pairs { frequency , value }
List < Tuple < int , int > > pq = new List < Tuple < int , int > > ( ) ; int cnt = 0 ; foreach ( KeyValuePair < int , int > pa in mp ) pq . Add ( new Tuple < int , int > ( pa . Value , pa . Key ) ) ;