[原创]数据结构学习笔记之三:二叉树
这个好像没什么写的.还是老样子,一如既往的翻译成java。 二叉树节点:
package binarytree;
public class Node {
Node parent;
Node leftChild,rightChild;
Object element;
Node(Object o,Node p,Node l,Node r)
{
parent=p;
leftChild=l;
rightChild=r;
element=o;
}
Node(Object o)
{
this(o,null,null,null);
}
Node(Object o,Node p)
{
this(o,p,null,null);
}
Node(Object o,Node l,Node r)
{
this(o,null,l,r);
}
}
二叉树类:
package binarytree;
public class BinaryTree {
private Node root;
BinaryTree()
{
root=null;
}
public boolean isFull()
{
return false;
}
public boolean isEmpty()
{
return root==null;
}
public void makeEmpty()
{
root=null;
}
}
Test case呢??? 这个好像没什么写。
我去写霍夫曼。 翻译之神,
你不如把用C表示的数据结构翻译成C++,用面向对象的方法来做,我觉得这是更适合你现在做的事情。
诚心建议。
页:
[1]