The second chapter of programming Zhu Ji Nanxiong Exercise 1

Source: Internet
Author: User

Problem Description:

Consider the problem of finding all the conjugation words for a given input word. How to resolve the issue only given words and dictionaries. What happens if there is some time and space to respond to pre-processing of any query.

Problem Resolution:

1, given the word has a unique identifier and length, then in the case of sequential traversal of the whole dictionary, we can first calculate the length of the input word, length, skip, equal length, calculate the word identification, and then compare the identity and the identification of a given word.

Solution:

Scenario 1: In the case of no preprocessing, the solution is as above: problem Resolution 1, if you can pre-processing, the author gives the scheme is: to calculate the whole dictionary word ( identification, Word s) pair, and sort by identity, perform a second search, find the pair, J found all the conjugation words. the identity pair here should be a one-to-many mapping relationship.

Code implementation Reference: The second chapter of programming Zhu Ji Nanxiong questionc: The problem of solving the modified words


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.