正文

汇编语言实现二叉树的存储和遍历(一)2005-08-17 17:06:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/hofy/3880.html

分享到:

;;;;;;;;;;;;;;;;;二叉树的遍历 .model small .stack 64 .data ;-------------------------------------------------------------------------------------------------------------------------------- binary db 63 dup (0,0,0) hey1 db 'Please input the root of the binary:',0dh,0ah,'$' hey2 db 0dh,0ah,'Does ',27h,'$' hey3 db 27h,' have a leftchild?(If it no leftchild,please press ENTER)',0dh,0ah,'$' hey4 db 27h,' have a rightchild?(If it no rightchild,please key in ENTER)',0dh,0ah,'$' hey5 db 'The first root traversing:',0dh,0ah,'$' hey6 db 'The middle root traversing:',0dh,0ah,'$' hey7 db 'The last root traversing:',0dh,0ah,'$' hey8 db 0dh,0ah,'$' hey9 db 0dh,0ah,'The input is over!','$' hey10 db 0dh,0ah,'Pree anykey to continue,ESC to finish...',0dh,0ah,'$' ;--------------------------------------------------------------------------------------------------------------------------------- .code main proc far                                           ;the main procedure          mov ax,seg hey1          mov ds,ax          jmp loop2 start1:mov cx,189           mov bx,offset binary           mov dx,0 loop1:mov byte ptr[bx],dl          inc bx          dec cx          cmp cx,0          jnz loop1 loop2:mov dx,offset hey1          mov ax,0900h          int 21h          mov si,offset binary          sub cx,cx          mov ax,0100H          int 21h          cmp al,0dh          jz exit1          add cx,3          call Inroot                     call firstr               mov ax,0900h          mov dx,offset hey8          int 21h          mov dx,offset hey6          int 21h          mov si,offset binary          mov cx,3           call midr            mov dx,offset hey8          int 21h           mov dx,offset hey7           int 21h           mov si,offset binary           mov cx,3           call lastr             mov dx,offset hey10          int 21h          mov ax,0100h          int 21h          cmp al,1bh          jnz start1 exit1:  mov ax, 4c00h          int 21h main endp

阅读(3112) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册