Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:是不是判断出来需要多少个节点,左右之树多少个节点,然后递归建立树,最后一次先序编历就好了

Posted by gzw_02 at 2008-06-21 15:56:19 on Problem 1095
In Reply To:是不是判断出来需要多少个节点,左右之树多少个节点,然后递归建立树,最后一次先序编历就好了 Posted by:first at 2003-12-10 19:32:09
单纯判断左右子树的结点数是不够的,还要判断左右子树的order(在计算出结点数的基础上做一次除法,一次取模就可以了)
还有,打印的遍历不是先序,而是中序。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator