204 */ InitiateStack s ; /* s */ i = n; t = p = new node; /* */ p->data = postorder[i]; while i > q = new node; if parent[i - ] == postorder[i] S,T S

Similar documents
1

, [3 ] Petri, 25 7, 500, [4,5 ], 3, (2), 2003, [ 6 ],,, ,, [7 ], 569, 26, ( ) : 2 ; 3 ; 4, ; 5, : (a) ( ) :,,

Microsoft Word - 专论综述1.doc

填 写 要 求 一 以 word 文 档 格 式 如 实 填 写 各 项 二 表 格 文 本 中 外 文 名 词 第 一 次 出 现 时, 要 写 清 全 称 和 缩 写, 再 次 出 现 时 可 以 使 用 缩 写 三 涉 密 内 容 不 填 写, 有 可 能 涉 密 和 不 宜 大 范 围 公

F4

2 3. 1,,,.,., CAD,,,. : 1) :, 1,,. ; 2) :,, ; 3) :,; 4) : Fig. 1 Flowchart of generation and application of 3D2digital2building 2 :.. 3 : 1) :,

untitled

80 温 州 大 学 学 报 社 会 科 学 版 (2012) 第 25 卷 第 1 期 构 混 乱 表 意 不 明 不 合 逻 辑 其 中 前 四 种 属 于 结 构 类 语 病, 考 查 几 率 较 高 ; 后 两 种 属 于 语 义 类 语 病, 有 时 会 单 独 出 题 上 面 这 道 题

45

IT 36% Computer Science Teachers Association, CSTA K K-12 CSTA K-12 K-12 K-6 K6-9 K STEM STEM STEM

2009/2 45 ART RESEARCH

44 深 圳 信 息 职 业 技 术 学 院 学 报 第 10 卷 业 实 际 进 出 口 单 证 样 本 的 演 示 与 讲 解, 导 致 学 生 在 学 校 看 到 的 都 是 过 时 的 单 据 演 练 的 陈 旧 的 工 作 流 程, 走 上 工 作 岗 位 后, 一 旦 遇 到 实 际 问

PCA+LDA 14 1 PEN mL mL mL 16 DJX-AB DJ X AB DJ2 -YS % PEN

标题

标题

48 Computer Education 课 程 体 系 设 置 2.1 科 学 设 置 培 养 方 案 课 程 模 块, 确 定 培 养 方 向 首 先, 我 们 通 过 对 人 才 市 场 需 求 分 析, 确 定 了 专 业 培 养 目 标 然 后, 根 据 教 育 部 高 等

标题

ZS.indd

Microsoft Word - 19王建华.doc


Microsoft Word - A doc

标题

附件4

Vol. 22 No. 4 JOURNAL OF HARBIN UNIVERSITY OF SCIENCE AND TECHNOLOGY Aug GPS,,, : km, 2. 51, , ; ; ; ; DOI: 10.

第 30 卷 苏 州 教 育 学 院 学 报 文 化 休 闲 旅 游 资 源 为 主 要 特 色 新 城 区 休 闲 地 主 要 包 括 工 业 园 区 高 新 区 吴 中 区 相 城 区 四 区 和 吴 江 区 的 一 部 分, 大 致 以 苏 州 绕 城 高 速 公 路 为 界 本 区 以 湖

2013国际营销科学与信息技术大会(MSIT2013)

m m m ~ mm

第 一 部 分 学 校 概 况 苏 州 大 学 坐 落 于 素 有 人 间 天 堂 之 称 的 古 城 苏 州, 是 国 家 211 工 程 重 点 建 设 高 校 2011 计 划 首 批 认 定 高 校, 是 江 苏 省 属 重 点 综 合 性 大 学, 其 主 要 前 身 为 创 建 于 19

4 115,,. : p { ( x ( t), y ( t) ) x R m, y R n, t = 1,2,, p} (1),, x ( t), y ( t),,: F : R m R n.,m, n, u.,, Sigmoid. :,f Sigmoid,f ( x) = ^y k ( t) =

CHINA SCIENCE AND TECHNOLOGY DEVELOPMENT REPORT

2011年上海市高校精品课程申报表(本科)

~ ~ ~ ~ ~ ~ ~ % % ~ 20% 50% ~ 60%

中 国 系 统 工 程 学 会 理 事 会 民 主 管 理 办 法 中 国 系 统 工 程 学 会 行 政 人 员 人 事 管 理 制 度 中 国 系 统 工 程 学 会 财 务 管 理 办 法 教 育 系 统 工 程 专 业 委 员 会 2015 年 工 作 总 结 过 程 系 统 工 程 专 业

Sep (SCI) 10. Jiann-Ming Wu, Annealing by two sets of interactive dynamics, IEEE Trans. on Systems Man and Cybernetics Part B-Cybernetics 34 (3)

SVM OA 1 SVM MLP Tab 1 1 Drug feature data quantization table


罗 森 平 1989 年 1 月 2007 年 9 月 2011 年 7 月 无 无 就 读 于 清 华 大 学 数 学 科 学 系 罗 森 平, 男, 汉 族,1989 年 1 月 生, 江 西 永 丰 人, 数 学 在 读 博 士,2010 年 6 月 加 入 中 国 共 产 党 2007 年

第16卷 第2期 邯郸学院学报 年6月

,,, () 20 80,,,,, ;,, ;,, ;,,,,,,,,, [1 ], :,,,,2 2,,, () (),,,,:,,,,:,,,, :, [2 ] :,,,,,,, : AN NA,,,,,, ( ),:,,: ( F) = (A1 + A2 + A3 + An -

威 福 髮 藝 店 桃 園 市 蘆 竹 區 中 山 里 福 祿 一 街 48 號 地 下 一 樓 50,000 獨 資 李 依 純 105/04/06 府 經 登 字 第 號 宏 品 餐 飲 桃 園 市 桃 園 區 信 光 里 民

1 引言

mm ~

0 5 32

1.2 资 金 的 管 理 1.1 权 利 义 务 来 源 MOU 1.3 数 据 的 使 用 和 保 护 2 国 际 空 间 站 资 源 分 配 方 案 54

<4D F736F F D F B0E6B8DFB1BBD2FDD6B8CAFDC7B0D1D42E646F63>

untitled

《红楼梦》中茗烟与李贵的对比分析

9, : Java 19., [4 ]. 3 Apla2Java Apla PAR,Apla2Java Apla Java.,Apla,,, 1. 1 Apla Apla A[J ] Get elem (set A) A J A B Intersection(set A,set B) A B A B

龍華科技大學數位典藏論文

附件1:

31

复 变 函 数 与 积 分 变 换 常 微 分 方 程 数 值 分 析 数 值 分 析 课 程 实 习 微 分 方 程 数 值

Microsoft Word - 专论综述1.doc

封皮:

P.2 6:45 7:00 pm 7:00 7:10 pm 7:10 7:30 pm 7:30 8:00 pm 8:00 8:30 pm P.3 P.4 P.6 P.7 P.10 P.10 P.11 P.12 P.13 P.14 P.15 P.16 P.17 P.24 P.25 P.26 P.27

附3

,.,,.. :,, ,:, ( 1 ). Π,.,.,,,.,.,. 1 : Π Π,. 212,. : 1)..,. 2). :, ;,,,;,. 3

实 践 探 讨 高 丽 : 从 少 数 民 族 大 学 生 的 阅 读 需 求 看 民 族 院 校 图 书 馆 的 资 源 建 设 有 区 域 性 和 民 族 性 很 强 的 传 统 学 科 特 色 学 科 及 优 势 学 科, 因 此 图 书 馆 的 资 源 建 设 也 要 顺 应 这 一 特 性

专 技 能 1. 精 通 Matlab/Simulink 平 台 下 的 海 洋 运 载 器 运 动 控 制 系 统 与 仿 真 建 模 设 计 ; 2. 精 通 51 单 片 机 AVR 单 片 机 Arduino 开 源 板 的 开 发 和 设 计 ; 3. 精 通 基 于 Arduino 板

元培科技大學 年度「傑出校友」推薦表

北 京 大 学

indd

好文如茶: 理性的澄澈与透明

标题

p

Mechanical Science and Technology for Aerospace Engineering October Vol No. 10 Web SaaS B /S Web2. 0 Web2. 0 TP315 A

Microsoft Word - A doc

标题

济南信息工程学校章程

Microsoft Word - netcontr.doc

Vol. 15 No. 1 JOURNAL OF HARBIN UNIVERSITY OF SCIENCE AND TECHNOLOGY Feb O21 A

Microsoft Word - ED-774.docx

F3

标题


PowerPoint Presentation

标题

Improving the Effectiveness of the Training of Civil Service by Applying Learning Science and Technology: The Case Study of the National Academy of Ci

张 英 洪 等 : 北 京 市 乡 村 治 理 现 状 及 问 题 研 究 北 沟 村 治 理 的 主 要 做 法 和 特 点 有 以 下 几 个 方 面 是 村 规 民 约 涉 及 村 干 部 和 村 民 生 产 生 活 的 各 个 方 面, 非 常 具 体 详 细 现 行 的 村 规 民 约 涵

CHINA SCIENCE AND TECHNOLOGY DEVELOPMENT REPORT ()

68 ( ) 2006,,,,,,,,,, (narrative history),,, [1 ] (P ),,,,,,, [ 2 ] ( P ), ;,,,,,,,,,,,,,, (1917),, 30,,,, :,, ;,,,,, ( ) ( ), :,,,,,,,,,,

(Pattern Recognition) 1 1. CCD

第十一届“21世纪杯”全国中小学生英语演讲比赛

簡章內容

[1] Liu Hongwei,2013, Study on Comprehensive Evaluation of Iron and Steel Enterprises Production System s Basic Capacities, International Asia Confere

高等学校教师职务申报表(高级职务)

<4D F736F F D20C9CFBAA3BFC6BCBCB4F3D1A7D0C5CFA2D1A7D4BA C4EAC7EFBCBEC8EBD1A7B2A9CABFD7CAB8F1BFBCCAD4CAB5CAA9CFB8D4F22D C8B7B6A8B8E5>

( ) [11 13 ] 2 211,,, : (1),, 1990 ( ) ( ),, ; OD, ( ) ( ) ; , ( ), (2) 50 %,, 1999 ( ) ( ) ; (3),,

标题

13-4-Cover-1

2011第1期第二部分

P.2 P.3 P.4 P.7 P.9 P.11 P.13 P.14 P.17 P.19 P.20 P.20 P.20 P.21 P.22 P.22 P.23 P.24 P.24 P.25 P.25 P.26 P.27 P.28 P.29

I041 JOURNAL OF ZHEJIANG UNIVERSITY SCIENCE A I159 JOURNAL OF ZHEJIANG UNIVERSITY SCIENCE B I184 MINING SCIENCE AND TECHNOLOGY F019 MOLECULAR PLANT I2

, , 10, , %, % %; %, % %,2030,, 2., ,90%,

中北大学常规事项财务报销操作指南

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f

2 ( 自 然 科 学 版 ) 第 20 卷 波 ). 这 种 压 缩 波 空 气 必 然 有 一 部 分 要 绕 流 到 车 身 两 端 的 环 状 空 间 中, 形 成 与 列 车 运 行 方 向 相 反 的 空 气 流 动. 在 列 车 尾 部, 会 产 生 低 于 大 气 压 的 空 气 流


第十一届“21世纪杯”全国中小学生英语演讲比赛

定稿

Transcription:

28 4 Vol.28 No.4 4 204 2 JOURNAL OF NANTONG VOCATIONAL UNIVERSITY Dec. 204!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! doi:0.3969/j.issn.008-5327.204.04.024 唐自立 ( 苏州大学计算机科学与技术学院, 江苏苏州 25006) : 提出一种新的由一棵严格二叉树的后序序列和结点的双亲情况构造该严格二叉树的非递 归算法通过实例说明该算法的执行过程, 假设 n 是严格二叉树的结点的个数, 该算法的时间复杂度 和最差情况空间复杂度都是 O(n) : 非递归算法 ; 严格二叉树 ; 后序序列 ; 结点的双亲 ; 严格二叉树构造 : TP30.6 : A : 008-5327(204)04-0093-06 A Non-recursive Algorithm for Constructing a Strictly Binary Tree from Its Post-order Traversal and the Parent of Each Node TANG Zi-li School of Computer Science and Technology, Soochow University, Suzhou 25006, China Abstract: A new non-recursive algorithm is presented for constructing a strictly binary tree from its post-order traversal and the parent of each node. The execution of the algorithm is illustrated by an example. Let n be the number of nodes of a strictly binary tree. The time complexity and the worst case space complexity of the algorithm are both O n. Key words: non-recursive algorithm; strictly binary tree; postorder traversal; parent of node; strictly binary tree construction [2] [] [2] [3-8] : 204-09-8 : (6075040); (0KJA52004); (BK202645); (BY2024) : 965-93

204 */ InitiateStack s ; /* s */ i = n; t = p = new node; /* */ p->data = postorder[i]; while i > q = new node; if parent[i - ] == postorder[i] S,T S Push s p ;,U T p->rightchild = q;, else U NULL; p->leftchild = q; p = q; p->data = postorder[--i]; p->leftchild = p->rightchild = NULL; DestroyStack s ; U 2 # n 7 U postorder[..7] parent[..7] v t a s v v b t c postorder[..7] parent[6] A =postorder A d preorder[..7] parent[5] C =postorder[6] ConstructSBT7 &t postorder[ ] parent[ ] n C C /* t postorder[..n] parent[..n] p ->leftchild = p ->rightchild = Pop s p ; BFGDECA ADDCCA# postorder [7] A [7] A A postorder[6] C C 94

4 parent[4] C postorder[5] E E postorder[2] F NULL C h preorder C [..7] parent[] postorder[4] D A postorder[2] F F f postorder[..7] NULL A parent [3] D =postorder parent [2] D pos- postorder[5] E e torder[3] G G postorder [..7] NULL D [4] D D postorder[] D B i preorder[..7] B postorder [3] G g preorder[..7] NULL j D A s k a b c d 95

204 e f g h 96

第4期 唐自立 由后序序列和结点的双亲情况构造严格二叉树的非递归算法 i j k 图 3 实例执行过程 算法分析 假设 n n 是一棵严格二叉树的结点的 个数 那么 n 一定是正奇数[ 8 ] 在时间开销上 由于执行算法 时要循环 n - 次 而每循环一次都要花费 O 时间 则执 行算法 总共要花费 O n 时间因此 算法 的 时间复杂度是 O n 在空间开销上 当所构造的严格二叉树有以 97

204 988,28(6):297-299. tree from its traversals n- / 2 O n 992,42(2):7-9. O n 4 989,29(3):572-575. O n [2] BIT,989,29(2):36-363. Systems,996,7(2):28-224. : [] Knuth D E. The art of computer programming,vol.,fundamental algorithms [M]. 3rd ed. Reading,MA:Addison-Wesley, 997. [2] 唐自立. 基于遍历序列的唯一确定树或二叉树的方法 [J]. 小型 微型计算机系统,200,22(8):985-988. [3] Andersson A,Carlsson S. Construction of a tree from its traversals in optimal time and space[j]. Information Processing Letters, 990,34():2-25. [4] Burgdorff H A,Jajodia S,Springsteel F N,et al. Alternative methods for the reconstruction of trees from their traversals [J]. BIT,987,27(2):34-40. [5] Chen G H,Yu M S,Liu L T. Two algorithms for constructing a binary tree from its traversals [J]. Information Processing Letters, [6] Gabrani N,Shankar P. A note on the reconstruction of a binary [J]. Information Processing Letters, [7] Kamakoti V,Rangan C P. An optimal algorithm for reconstructing a binary tree[j]. Information Processing Letters,992,42(2): 3-5. [8] M 覿 kinen E. Constructing a binary tree from its traversals[j]. BIT, [9] M 覿 kinen E. Constructing a binary tree efficiently from its traversals [J]. International Journal of Computer Mathematics,2000,75 (2):43-47. [0] Olariu S,Overstreet M,Wen Z F. Reconstructing a binary tree from its traversals in doubly logarithmic CREW time[j]. Journal of Parallel and Distributed Computing,995,27():00-05. [] Slough W,Efe K. Efficient algorithms for tree reconstruction[j]. [2] Stojmenovic I. Constant time BSR solutions to parenthesis matching, tree decoding, and tree reconstruction from its traversals [J]. IEEE Transactions on Parallel and Distributed [3] Wen Z F. New algorithms for the LCA problem and the binary tree reconstruction problem [J]. Information Processing Letters, 994,5():-6. [4] Xiang L M,Lawi A,Ushijima K. On constructing a binary tree from its traversals [J]. Research Reports on Information Science and Electrical Engineering of Kyushu University,2000,5(): 3-8. [5] 唐自立. 基于遍历序列的构造二叉树的算法 [C]// 全国计算机技术应用与高等学校计算机教育论文集 ( 第 卷 ), 成都 : 西 南交通大学出版社,2009:394-397. [6] 唐自立. 基于遍历序列的构造严格二叉树的算法 [J]. 苏州大学学报 : 自然科学版,200,26(3):40-43. [7] 唐自立. 基于遍历序列的构造树的算法 [J]. 苏州大学学报 : 自 然科学版,20,27(3):26-29. [8] 唐自立. 由先序序列和结点的左孩子情况构造严格二叉树的高效算法 [J]. 南通大学学报 : 自然科学版,203,2():9-3. 98