
数据结构
文章平均质量分 67
Reid__
这个作者很懒,什么都没留下…
展开
-
线性链表:单链
C++中线性表的单链表存储结构:typedef struct Lnode{ elemtype data; struct Lnode *next; //指向下一个结点的指针}Lnode,*LinkList; //这里给两种变量起了别名,一个是struct Lnode起别名为Lnode,一个是struct Lnode*起别名为LinkList链表的第一项是不储原创 2017-08-26 16:45:21 · 414 阅读 · 0 评论 -
栈的实现
栈的存储结构:typedef struct{ elemtype *top; elemtype *base; int stacksize;}SqStack;函数InitStack,构造一个空栈:status InitStack(SqStack& s){ s.base=(elemtype *)malloc(100*sizeof(原创 2017-08-26 17:08:11 · 283 阅读 · 0 评论 -
leetcode : mergeTrees(递归)
题:输入两颗二叉树,将它们合成为一颗二叉树,合成规则如下,The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of new tr原创 2017-08-29 21:03:54 · 606 阅读 · 0 评论 -
leetcode : twosum/BST
题:判断二叉树中是否有满足x+y=target的整数对(x,y)代码:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x)原创 2017-08-29 19:25:11 · 287 阅读 · 0 评论