文件名称:LeastCommonAncestors
介绍说明--下载内容均来自于网络,请自行研究使用
求一棵二叉树的2个结点的最近公共祖先
输入:根据带空指针的先序遍历结果建立普通二叉树
数据元素类型:字符类型
空指针: #
输入格式: 第一行:依次为元素个数N
第二行:元素序列
第三行:字符x 字符y
输出格式:x与y的最近共同祖先的元素值,或者NULL。
注意:1、输入错误时,输出ERROR(大写)并结束程序。2、树节点保存的元素值为字符类型。3、任意多余输出视为错误。4、二叉树的结点关键字是主关键字
-Seeking a binary tree of two recent common ancestor node input: with a null pointer under preorder traversal results establish ordinary binary data element types: character type null pointer:# Input format: The first line: the order of the number of elements N Second row: the third line of the sequence of elements: Character x Character y output format: x and y of the most recent common ancestor of the element value, or NULL. Note: 1, input error, the output ERROR (uppercase) and end the program. 2, the elements of the tree node holds the value character type. 3, any excess output as an error. 4, the binary tree node keyword is the primary key
输入:根据带空指针的先序遍历结果建立普通二叉树
数据元素类型:字符类型
空指针: #
输入格式: 第一行:依次为元素个数N
第二行:元素序列
第三行:字符x 字符y
输出格式:x与y的最近共同祖先的元素值,或者NULL。
注意:1、输入错误时,输出ERROR(大写)并结束程序。2、树节点保存的元素值为字符类型。3、任意多余输出视为错误。4、二叉树的结点关键字是主关键字
-Seeking a binary tree of two recent common ancestor node input: with a null pointer under preorder traversal results establish ordinary binary data element types: character type null pointer:# Input format: The first line: the order of the number of elements N Second row: the third line of the sequence of elements: Character x Character y output format: x and y of the most recent common ancestor of the element value, or NULL. Note: 1, input error, the output ERROR (uppercase) and end the program. 2, the elements of the tree node holds the value character type. 3, any excess output as an error. 4, the binary tree node keyword is the primary key
(系统自动生成,下载前可以参看下载内容)
下载文件列表
寻找最近公共祖先.c