To ensure completeness of classification discussions when designing algorithms

Source: Internet
Author: User
Tags tidy

1 What is completeness

If the algorithm has more than one branch, make sure that each branch is gone. This time if you do not tidy up their own confused, programming is prone to errors. To tidy up clearly.

2 What's going to happen to the completeness of the problem

When the trend of the algorithm is affected by the value of 2, 3 and more variables, it will appear to be divided into several branches to consider, resulting in complete problems.

For example, 3 variables can be true and false, then there are 8 possible scenarios. In addition, the most deadly is to ensure logical rationality, in determining the order of the variables to determine, you also need to explore, maybe A's decision placed in the back of B will make the whole logic clearer.

3 How to ensure completeness

First, determine the number of possible, such as a, B, c three variables, a and C there are 2 possible, b there are 3 possible. So there's a total of 2*2*3=12 possible.

Second, the proper arrangement of the order of decisions A, B, C, to ensure that each of the branching species may have come, and is logical.

To ensure completeness of classification discussions when designing algorithms

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.