当前位置: 技术问答>java相关
能否贴个二叉树结构和遍历的源程序?50相送
来源: 互联网 发布时间:2015-07-21
本文导语: java或vb都行 | import java.util.*; import java.awt.*; class Binary_sort_tree { bnodetp bst; boolean found=false; bnodetp f=null; String errorMessage=null; Vector bnodetpVector=new Vector(); Vector cenciVector=new Vector(); public...
java或vb都行
|
import java.util.*;
import java.awt.*;
class Binary_sort_tree
{
bnodetp bst;
boolean found=false;
bnodetp f=null;
String errorMessage=null;
Vector bnodetpVector=new Vector();
Vector cenciVector=new Vector();
public Binary_sort_tree()
{
bst=null;
errorMessage=null;
}
public bnodetp srch_bstree(bnodetp bst,int k)//查找节点
{
found=false;
if(bst==null)
{
found=false;
return f;
}
else if(bst.key==k)
{
found=true;
f=bst;
return(bst);
}
else if(k
import java.awt.*;
class Binary_sort_tree
{
bnodetp bst;
boolean found=false;
bnodetp f=null;
String errorMessage=null;
Vector bnodetpVector=new Vector();
Vector cenciVector=new Vector();
public Binary_sort_tree()
{
bst=null;
errorMessage=null;
}
public bnodetp srch_bstree(bnodetp bst,int k)//查找节点
{
found=false;
if(bst==null)
{
found=false;
return f;
}
else if(bst.key==k)
{
found=true;
f=bst;
return(bst);
}
else if(k