当前位置:网站首页>Application scenarios of Catalan number
Application scenarios of Catalan number
2022-07-03 06:39:00 【I also want to write bugs today】
List of articles
Carter LAN number
Derivation of Cartland number :
Carter LAN number (Catalan)

Application scenarios
Suppose there is n A left bracket and n Right parenthesis , How many legal combinations do they have .
Altogether C(2n,n) Combinations of , Suppose these combinations are A aggregate .
For illegal combinations , There must be a prefix , The number of right parentheses is more than that of left parentheses 1 individual , such as())(()Chinese prefix()), And the suffix must be the right bracket less than the left bracket 1 One((), We reverse the suffix ( The left bracket becomes the right bracket , The right bracket becomes the left bracket ), In this way, the right bracket in the whole combination is n+1, The left bracket is n-1. There are C(2n,n-1) Combinations of , Suppose they are B aggregate .
A Illegal combinations in can be pushed through inversion B All cases in the set , and B Collections can also be pushed out by reversing A Illegal combination in . therefore A The illegal quantity in is equal to C(2n,n-1).
Sum up , There are legal combinations C(2n,n)-C(2n,n-1) Kind of .n How many legal ways to get in and out of the stack .
The number of any prefix out of the stack must be less than the number of prefix in the stack , So this problem turns into the bracket problem above . Its combination is also C(2n,n)-C(2n,n-1) Kind of .Altogether n Nodes , How many ways to form a binary tree .
Yes 0 Nodes , The method is empty tree , The way to form a binary tree 1 Kind of .
Yes 1 Nodes , The tree is for itself ,1 Kind of .
Yes 2 Nodes , root + Left or root + Right ,2 Kind of .
Yes n Nodes , Select a node as the head node ; The left side of the head node 0 Nodes , On the right n-1 Nodes ; The left side of the head node 1 Nodes , On the right n-2 Nodes ; The left side of the head node 2 Nodes , On the right n-3 Nodes ... Can be launchedk(n)=k(0)*k(n-1)+k(1)*k(n-2)+....+k(n-2)*k(1)+k(n-1)*k(0), That is to say, the number of Cartland C(2n,n)-C(2n,n-1) Combination mode .
边栏推荐
- [system design] proximity service
- Example of joint use of ros+pytoch (semantic segmentation)
- Install VM tools
- 修改MySQL密码
- 每日刷题记录 (十一)
- JMeter linked database
- . Net program configuration file operation (INI, CFG, config)
- Difference between shortest path and minimum spanning tree
- Naive Bayes in machine learning
- SQL implementation merges multiple rows of records into one row
猜你喜欢
![[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)](/img/a4/00aca72b268f77fe4fb24ac06289f5.jpg)
[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)

Cesium Click to obtain the longitude and latitude elevation coordinates (3D coordinates) of the model surface

After the Chrome browser is updated, lodop printing cannot be called

Install VM tools

Personally design a highly concurrent seckill system

輕松上手Fluentd,結合 Rainbond 插件市場,日志收集更快捷

JMeter performance automation test

使用conda创建自己的深度学习环境

SQL implementation merges multiple rows of records into one row

Yolov2 learning and summary
随机推荐
DNS forward query:
POI dealing with Excel learning
每日刷题记录 (十一)
致即将毕业大学生的一封信
JMeter performance automation test
Creating postgre enterprise database by ArcGIS
Use selenium to climb the annual box office of Yien
Page text acquisition
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
保险公司怎么查高血压?
conda和pip的区别
(翻译)异步编程:Async/Await在ASP.NET中的介绍
The mechanical hard disk is connected to the computer through USB and cannot be displayed
[set theory] equivalence relation (concept of equivalence relation | examples of equivalence relation | equivalence relation and closure)
[untitled] 5 self use history
HMS core helps baby bus show high-quality children's digital content to global developers
SSH link remote server and local display of remote graphical interface
[open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle
Common interview questions
Scroll view specifies the starting position of the scrolling element