当前位置:网站首页>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 .
边栏推荐
- Learning notes -- principles and comparison of k-d tree and IKD tree
- Read blog type data from mysql, Chinese garbled code - solved
- Local rviz call and display of remote rostopic
- 爬虫代码基础教学
- 利用C#实现Pdf转图片
- golang操作redis:写入、读取hash类型数据
- conda和pip的区别
- 【5G NR】UE注册流程
- The dynamic analysis and calculation of expressions are really delicious for flee
- Example of joint use of ros+pytoch (semantic segmentation)
猜你喜欢
輕松上手Fluentd,結合 Rainbond 插件市場,日志收集更快捷
YOLOV1学习笔记
Yolov3 learning notes
[open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle
Create your own deep learning environment with CONDA
这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意
10万奖金被瓜分,快来认识这位上榜者里的“乘风破浪的姐姐”
HMS core helps baby bus show high-quality children's digital content to global developers
Numerical method for solving optimal control problem (I) -- gradient method
如何迁移或复制VMware虚拟机系统
随机推荐
vmware虚拟机C盘扩容
堆排序和优先队列
Mysql
Yolov3 learning notes
opencv
[C /vb.net] convert PDF to svg/image, svg/image to PDF
Simple understanding of ThreadLocal
【类和对象】深入浅出类和对象
Interesting research on mouse pointer interaction
Openresty best practices
[system design] proximity service
【C#/VB.NET】 将PDF转为SVG/Image, SVG/Image转PDF
Derivation of variance iteration formula
About the difference between count (1), count (*), and count (column name)
Ruoyi interface permission verification
[untitled] 5 self use history
Cannot get value with @value, null
100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners
表达式的动态解析和计算,Flee用起来真香
Use @data in Lombok to simplify entity class code