文件名称:ccc
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:7.42kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
在二叉搜索树上删除一个有两个子女的结点时,可以采用以下三种方法:
(1) 用左子树TL上具有最大关键码的结点X顶替,再递归地删除X。
(2) 交替地用左子树TL上具有最大关键码的结点和右子树TR上具有最小关键码的结点顶替,再递归地删除适当的结点。
(3) 用左子树TL上具有最大关键码的结点或者用右子树TR上具有最小关键码的结点顶替,再递归地删除适当的结点。可随机选择其中一个方案。
试编写程序实现这三个删除方法,并用实例说明哪一个方法最易于达到平衡化。
-In the binary search tree delete a node with two children, you can use the following three ways: (1) with a left subtree TL key code with the largest node X replacement, and then recursively delete X. (2) alternately with the left subtree TL key code with the largest node, and the right subtree TR on the key code with minimal replacement of nodes, then recursively delete the appropriate node. (3) with a left subtree TL key code with the largest node or with the right subtree TR key code that has the smallest node replacement, recursively delete the appropriate node. Can randomly select one of the options. Try to delete programming to achieve these three methods, with examples which the balance of the easiest ways.
(1) 用左子树TL上具有最大关键码的结点X顶替,再递归地删除X。
(2) 交替地用左子树TL上具有最大关键码的结点和右子树TR上具有最小关键码的结点顶替,再递归地删除适当的结点。
(3) 用左子树TL上具有最大关键码的结点或者用右子树TR上具有最小关键码的结点顶替,再递归地删除适当的结点。可随机选择其中一个方案。
试编写程序实现这三个删除方法,并用实例说明哪一个方法最易于达到平衡化。
-In the binary search tree delete a node with two children, you can use the following three ways: (1) with a left subtree TL key code with the largest node X replacement, and then recursively delete X. (2) alternately with the left subtree TL key code with the largest node, and the right subtree TR on the key code with minimal replacement of nodes, then recursively delete the appropriate node. (3) with a left subtree TL key code with the largest node or with the right subtree TR key code that has the smallest node replacement, recursively delete the appropriate node. Can randomly select one of the options. Try to delete programming to achieve these three methods, with examples which the balance of the easiest ways.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ccc.doc
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.