- 求二叉树的先序序列
- 2009-02-20 22:24:29 @
program K_NigHt_L;
var
xx,zx,hx:string;
procedure search(k:string);
var
i,j,max,maxt,lz:integer;
begin
lz:=length(k);
if lz=1 then write(k)
else
begin
max:=0;
maxt:=0;
for i:=1 to lz do
begin
if pos(k[i],hx)>max
then
begin
max:=pos(k[i],hx);
maxt:=i;
end;
end;
search(copy(k,1,i-1));
search(copy(k,i+1,lz-i));
end;
end;
begin
readln(zx);
readln(hx);
search(zx);
end.
1 条评论
-
天道无极 LV 5 @ 2015-10-12 19:55:04
。。。表示看不懂。
- 1