Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:本题怎么做,请高手指点!In Reply To:Re:本题怎么做,请高手指点! Posted by:GreedIsGood at 2006-10-31 12:55:48 > 还有btree,insert,preorder,自己写吧 > void main() > { > string s[100]; > int total=0,current=0,nextlen,currentlen; > cin>>s[total]; > while(s[total]!="$") > { > total++; > cin>>s[total]; > } > > while(current!=total) > { > > currentlen=current; > while(s[currentlen]!="*"&&s[currentlen]!="$") > currentlen++;//s currentlen=* > > if(s[currentlen]=="$") > nextlen=-1; > else nextlen=currentlen+1; > currentlen--; > btree * root=new btree; > root->food='@'; > while(currentlen!=current-1) > { > > int len; > for(int i=0;s[currentlen][i]!='\0';i++); > len=i; > for(i=1;i<=len;i++){ > insert(root,s[currentlen][i-1]); > > } > currentlen--; > } > preorder(root); > > current=nextlen; > > cout<<endl; > if(nextlen==-1) > break; > } > } thanks very much ~~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator