📄 linkedbasiclistwithrecclone.java
字号:
import dslib.list.*;
/** A variation of LinkedBasicListUos with a recursive implementation of listClone(). */
public class LinkedBasicListWithRecClone extends LinkedBasicListUos
{
/** Construct an empty list. <br>
Analysis: Time = O(1) */
public LinkedBasicListWithRecClone()
{
super();
}
/** Return a list clone of this list. <br>
Analysis: Time = O(k), k = number of items in the list */
public SimpleListUos listClone()
{
if (isEmpty())
return (SimpleListUos) clone();
else
{
SimpleListUos result = ((LinkedBasicListWithRecClone) firstRemainder()).listClone();
result.insertFirst(firstItem());
return result;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -