English word frequency algorithm in Java

Source: Internet
Author: User
The English word frequency algorithm implemented by Java is usually implemented by using a tree of words. Using Java to achieve word frequency statistics,
In order to count the frequency of words, the simplest way is to create a map, where key is the word, value
The number of delegates. Read the article from the beginning to the end, read a word on the map to check, if found the time
Number plus one, not found then put in map. This makes the code simple, but does not achieve the desired effect by
The performance test shows that performance is very poor. In terms of time complexity, the map time complexity is 0 (LOGN),
If the high-frequency words need to be sorted, even in the structure optimization, but the final still can not be greatly improved performance.

English word frequency algorithm in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.