📄 gtnode.java
字号:
/*请用BinaryNode 中的结构和方法实现该类。*/
public class GTNode extends BinaryNode
{
private GTNode parent;
/**
* constructor of GTNode
*/
public GTNode(Object obj){
super(obj);
parent=null;
}
/**
* return parent node.
*/
public GTNode parent(){
return parent;
}
/**
* set parent node.
*/
public void setParent(GTNode par){
parent=par;
}
/**********************fill your node for the following functions.********************/
/**
* test if this node is a leaf.
*/
public boolean isLeaf(){
//fill your code here.
}
/**
* return leftmost child node.
*/
public GTNode leftmostChild(){
//fill your code here.
}
/**
* return next sibling node.
*/
public GTNode rightSibling(){
//fill your code here.
}
/**
* insert a node as the leftmost child node of this node.
*/
public void insertFirst(GTNode n){
//fill your code here.
}
/**
* insert a node as the next sibling node of this node.
*/
public void insertNext(GTNode n){
//fill your code here.
}
/**
* remove the leftmost child of this node.
*/
public void removeFirst(){
//fill your code here.
}
/**
* remove the next sibling of this node.
*/
public void removeNext(){
//fill your code here.
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -