根据前中序遍历构建二叉树

根据前中序遍历构建二叉树

算法语言 2年前 (2015-11-01) 浏览: 247 评论: 1

根据前序遍历和中序遍历构建二叉树的基本思想是使用递归算法;首先构建根节点的左子树和右子树,而在构建根节点的左右子树的时候又要构建左右子树根节点的左右子树, 所以很容易想到递归算法;本项目构建二叉树的主要函数是CreateBinaryTree,其参数有char *preorder, char *inorder, int n,分别是当前构建二叉树的前序排列和中序排列和结点个数;直到构建的子二叉树中节点个数为零,即完成了递归。 根据前中序遍历构建二叉树  

数据结构-传染病问题

数据结构-传染病问题

算法语言 3年前 (2014-11-30) 浏览: 175 评论: 1

Description This assignment asks you to finish the implementation of a program that assesses the level of infection in a tissue sample. You are given data representing a rectangular tissue sample, overlaid with a grid. Certain portions of the tissue are infected; others are not. Your goal is to help assess the extent of the infection by writing a program that, given the coordinates of a colony of infection, can determine its size. A typical use of the program follows. The user interacts with the program only through command-line arguments. The user supplies to the program a data filename and the coordinates of a cell in the grid. The coordinates are specified by row and then column, both starting at zero. The program calculates the extent of infection at that coordinate and outputs a two-dimensional representation of the tissue sample. Figure 1 depicts(叙述) the execution(执行) of the program. 代码

登录

忘记密码 ?

您也可以使用第三方帐号快捷登录

切换登录

注册