Cattleya number (Catalan) formula, demonstrated codes, Code Example

Gangster blog: Portal

 

1. Stack the order

2.01 Sequence

3. '+1' 1 'sequence

4. The sequence in brackets

5. Keep the change problem

6. Matrix Chain

7. binary count

8. convex polygon division

9. n on a circle line segments

10. monotonic path

11. fill staircase pattern

12. The stack of bowls problem

13. alley refueling car

14. The question also book library

15. The height queuing problem

Code Example:

1. Stack the order of
a stack (infinity) into the stack of sequence 1,2,3, ..., n, the number of different pop sequence?

2.01 sequence
gives a n, requires a 2n sequence of length 01, so that any prefix sequence number not less than 1 number of zeros, the number of different sequences of 01?
Or less with a length of 6 sequence:
111000 101 100 101 010 110 010 110 100

 

3. '+1' 1 'sequence

n and n + 1 th number of 2n items constituting a1 -1, a2, ⋅⋅⋅, a2na1, a2, ⋅⋅⋅, a2n, and some of its properties satisfy the non-negative, i.e., a1 + a2 + ⋅⋅⋅ + ak> = 0a1 + a2 + ⋅⋅⋅ + ak> = 0, (k = 1,2, ···, 2n), this sequence number has a different?

4. The sequence in brackets

n How many matching pair of parentheses way?

5. Keep the change problem

2n personal five dollars to buy a ticket for the movie tickets, buy only one per person, but the conductor does not give change money. Where, n individual holding five dollars, held by individuals in addition n ten dollars and asked difficult in the case of the change does not occur, how many queuing?

6. Matrix Chain

P = a1 × a2 × a3 × ...... × an, based on the multiplication is associative, the order does not change, only a pair of parentheses represents the product, how several brackets of the program?

7. binary count

There are n nodes consisting of binary (non-leaf node has two sons), there are many kinds of situations?
There are number of n + 1 binary tree leaves?
,

8. convex polygon division

In an n-sided polygon by polygon does not intersect the n internal diagonal, the n-gon is split into a plurality of triangles, and asked how many programs split?


9. n on a circle line segments

2n selected points on the circle, the points are connected together in pairs such that the number n of line segments obtained disjoint method?

10. monotonic path

A big city lawyer in n n blocks east and one block north of his home, he walked every day 2n blocks to work. If he never crossing (but can be touch) diagonal from home to the office, then how many possible way?

11. fill staircase pattern

A height of the stepped pattern of n, the number of rectangles filled with n?

12. The stack of bowls problem

After dinner, washing dishes sister, sister to sister washed the bowl into a cupboard a pile into a pile. A total of n different bowl, wash before also pile into a pile, perhaps because the young girl fun to get into the bowl cupboard is not timely, the sister put the washed bowl next to the pile, and asked: piled up a young girl how many bowls possible way?

13. alley refueling car

A squad car on a narrow road driving, can not overtake, but you can enter a dead end to refuel, and then drive to jump the queue, there are n cars, ask how many different ways to make the team out of town?

14. The question also book library

In the queue, n is also a "interview Collection," a book, n in a borrowed "interview Collection," a book, library book at this time there is no interview, and ask them to line up the total number of 2n personal library altogether

15. The height queuing problem

2n a height different people, arranged in two rows, each row must be arranged from low to high, but high in the first row of the second person parallelism corresponding to the arrangement and asked how many?

Guess you like

Origin www.cnblogs.com/nlyzl/p/11564195.html