Sort the frequencies
int sz = v . Count ; int [ ] temp = new int [ sz ] ; for ( int i = 0 ; i < v . Count ; i ++ ) temp [ i ] = v [ i ] ; Array . Sort ( temp ) ; for ( int i = 0 ; i < v . Count ; i ++ ) v [ i ] = temp [ i ] ;