数据结构、算法
gaouuuu
这个作者很懒,什么都没留下…
展开
-
递归、非递归的前、中、后序遍历二叉树
rt,直接贴代码了 #include #include #include using namespace std; typedef struct Node{ int value; Node *left; Node *right; } Node; void visit(Node *root){ coutvalue)<<" "; } typedef struct原创 2013-06-17 15:01:00 · 411 阅读 · 0 评论 -
两个版本的二分查找
rt 直接贴代码 #include #include using namespace std; int normal_find(int *data, int length, int value){ int head = 0, tail = length-1; int pos = -1; while(head<=tail){ int mid = (t原创 2013-06-17 15:14:27 · 429 阅读 · 0 评论 -
二叉树转双向链表
rt 直接贴代码 #include #include using namespace std; typedef struct Node{ int value; Node *left; Node *right; } Node; void visitRight(Node *root){ Node *cur = root; while(cur){ cout原创 2013-06-17 15:16:00 · 488 阅读 · 0 评论