Java Foundation------Yang Hui Triangle (recursive implementation)

Source: Internet
Author: User

First column Second column Third column Fourth column Fifth Column Sixth column Seventh column Eighth column Nineth column Tenth column 11th column ......
First line First space
Second space A third space Fourth space Fifth space
1
Second line First space
Second space
A third space Fourth space
1 1
Third line First space
Second space
A third space 1 2 1
Line Four First space
Second space
1 3 3 1
Line Five A third space
1 4 6 4 1
Line Six 1 5 10 10 5 1
......

1. Overview of the Yang Hui Triangle  

premise: The number of endpoints and endings per line is 1.
    1. Each number equals two of the sum above it.
    2. Each line of numbers is symmetrical, starting from 1 to become larger.
    3. The number of the nth row has n items.
    4. The nth row number and 2n-1.
    5. The number of m in the nth row can be expressed as C (n-1,m-1), which is the number of combinations of m-1 elements taken from n-1 different elements.
    6. The number of the nth row is equal to the number of n-m+1 and is one of the combinatorial number properties.
    7. Each number equals the sum of the left and right two digits of the previous line.

2. Java implementation of the Yang Hui Triangle

  

Java Foundation------Yang Hui Triangle (recursive implementation)

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.