数据结构说明

Posted by Felix Zhang on 2020-06-05
Words 178 and Reading Time 1 Minutes
Viewed Times

数据结构(每日更新)

Leetcode平台上专注于算法实现,导致数据结构的实现未能得到有效的训练;但是在保研机试中需要自己将数据结构写出,故在此对STL中没有的数据结构的实现代码进行整理;

二叉树

1
2
3
4
5
6
7
8
9
10
11
//二叉树的建立
struct TreeNode{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x): val(x), left(NULL), right(NULL){}
};
//二叉树的输入
void CreateBiTree(BiTree *T){

}

N叉树(429)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//数据结构体
class Node{
public:
int val;
vector<Node*> children;
//构造函数
Node() {};
Node(int _val){
val = _val;
}
Node(int _val, vector<Node*> _children){
val = _val;
children = _children;
}
}
//数据结构的输入

This is copyright.