⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arrayedsimplelistwithrecclone.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
import dslib.list.*;

/**	A variation of ArrayedSimpleListUos that has a recursive version of listClone(). */
public class ArrayedSimpleListWithRecClone extends ArrayedSimpleListUos
{
	/**	Construct a new list with the specified newCapacity. <br>
		Analysis: Time = O(newCapacity) <br>
		@param length capacity of the new list*/
	public ArrayedSimpleListWithRecClone(int newCapacity)
	{
		super(newCapacity);
	}

	/**	Return a list clone of this list. <br>
		Analysis: Time = O(capacity) */
	public SimpleListUos listClone()
	{
		if (isEmpty())
		{
			ArrayedSimpleListWithRecClone tempClone = (ArrayedSimpleListWithRecClone) clone();
			tempClone.rep = new Object[rep.length];
			return tempClone;
		}
		else
		{
			Object firstItem = firstItem();
			deleteFirst();
			SimpleListUos result = listClone();
			result.insertFirst(firstItem);
			insertFirst(firstItem);
			return result;
		}
	}
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -