Most frequent k chars distance: Difference between revisions

no edit summary
No edit summary
Line 57:
</lang>
 
Aim of 'Most Frequent K Hashing' function is calculating the most count of each character and returning the K most frequent character with the character and count. Rules of hash can be listed as below:
Above function, simply gets an input string and an integer K value and outputs the most frequent K characters from the input string. The only condition during the creation of output string is adding the first occurring character first, if the frequencies of two characters are equal. Similar to the most of [[wp:hashing function|hashing functions]], ''Most Frequent K Hashing'' is also a [[wp:one way function]].
* Output will hold the character and count
* Most frequent character and count will appear before the least frequent at the output
* if two characters have equal frequency, the first appearing in input will appear before at the output
 
Similar to the most of [[wp:hashing function|hashing functions]], ''Most Frequent K Hashing'' is also a [[wp:one way function]].
 
===Most Frequent K Distance===
Distance calculation between two strings is based on the hash outputs of two strings.
The second step of algorithm works on two outputs from two different input strings and outputs the similarity coefficient (or distance metric).
<lang java>
int function MostFreqKSimilarity (String inputStr1, String inputStr2)
Anonymous user