优先队列(priority queue)是允许至少两种操作的数据结构:Insert及DeleteMin(删除最小者)。相当于队列中的Enqueue、Dequeue操作。优先队列可以用链表、二叉查找树、二叉堆等实现。二叉堆1. 结构性质堆(heap)是一棵完全被填满的二叉树,有可能的例外是在底层,底层...
分类:
其他好文 时间:
2014-06-26 22:16:43
阅读次数:
327
-- author : coder_zhang-- date : 2014-6-25root = nilfunction insert_node(number) if root == nil then root = {value = number, left = nil, ...
分类:
其他好文 时间:
2014-06-26 16:51:36
阅读次数:
170
题目:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]....
分类:
其他好文 时间:
2014-06-26 16:03:52
阅读次数:
296
题目:Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].N...
分类:
其他好文 时间:
2014-06-26 16:02:42
阅读次数:
172
#include#include "fatal.h"struct AvlNode;typedef struct AvlNode *Position;typedef struct AvlNode *AvlTree;typedef int ElementType ;AvlTree MakeEmpty(A...
分类:
编程语言 时间:
2014-06-25 13:23:40
阅读次数:
267
#include#include "fatal.h"struct TreeNode;typedef struct TreeNode *Position;typedef struct TreeNode *SearchTree;typedef int ElementType;SearchTree Mak...
分类:
编程语言 时间:
2014-06-25 12:53:17
阅读次数:
334
本文部分来源于CSDN兰亭风雨大牛的原创。链接为http://blog.csdn.net/ns_code/article/details/12977901二叉树是一种非常重要的数据结构,很多其他数据机构都是基于二叉树的基础演变过来的。二叉树有前、中、后三种遍历方式,因为树的本身就是用递归定义的,因此...
分类:
其他好文 时间:
2014-06-25 12:33:46
阅读次数:
327
面对这样的问题时我们该怎么解决?
今天写数据结构题,发现了一道总是碰见问题的题在这里我写了一种求解方法我自己称它为分层递归求解。
第一步通过观察我们知道后序遍历时最后一个是根节点A
在中序序列中A的左边是左子树右边是右子树
第二步我们来画第一层为根节点的右子树为A-C-F
第三步拆分左子树
在中序序列中为DBGE(因为我们不知道左子树中的树结构无法直接看出来就把左子树另外拆分出...
分类:
数据库 时间:
2014-06-25 07:52:29
阅读次数:
265