编程介的小学生
2017-11-08 16:10How Many Trees?
10Problem Description
A binary search tree is a binary tree with root k such that any node v reachable from its left has label (v) label (k). It is a search structure which can find a node with label x in O(n log n) average time, where n is the size of the tree (number of vertices).
Given a number n, can you tell how many different binary search trees may be constructed with a set of numbers of size n such that each element of the set will be associated to the label of exactly one node in a binary search tree?
Input
The input will contain a number 1 <= i <= 100 per line representing the number of elements of the set.
Output
You have to print a line in the output for each entry with the answer to the previous question.
Sample Input
1
2
3
Sample Output
1
2
5
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 使用codeigniter中的foreach()为传递给bootstrap模式的数据添加限制
- codeigniter
- php
- 3个回答
- 更改数组/对象嵌套组合数组中的值时出现问题
- arrays
- php
- 3个回答
- 数据结构C语言里二叉树和N叉数的综合运用问题,怎么从文件读取二叉树
- r语言
- Golang
- erlang
- 1个回答
- SOS 区分子树的算法问题,怎么使用C语言进行解决?
- r语言
- Golang
- erlang
- 1个回答
- How Many HouGong
- as
- each
- ai
- numbers
- 1个回答