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

📄 appendablelist.java

📁 赫夫曼编译码器: 用哈夫曼编码进行通信可以大大提高信道利用率
💻 JAVA
字号:
package structure;/** * An extension of the circular list class that provides  * an operation for merging an object of this type with * a CircularList in constant time.  This is accomplished * through pointer manipulation rather than by iterating through * the structure and copying each element as it appears.  * In the context of fibonacci heaps, this constant time merge method * facilitates the effecient implementation of the merge and remove  * methods. */public class AppendableList extends CircularList{    /**     * Provides a constant time function that merges the contents     * of two lists by appending l to this list.  The lists are     * merged by appending the contents of l to the contents of this     * list.     *      * @param l The list to be merged into this list     * @post This list contains all of the elements previously     *       contained by l.     *       l is destroyed.     */    public void merge(AppendableList l){	if (l.size() > 0){	    if(this.size() > 0){		//get the neccessary heads and tails		SinglyLinkedListElement h1 = tail.next();		SinglyLinkedListElement h2 = l.tail.next();		SinglyLinkedListElement t2 = l.tail;				//do the swapping		tail.setNext(h2);		tail = t2;		t2.setNext(h1);	    } else {		tail = l.tail;	    }	    count += l.count;	}    }}    

⌨️ 快捷键说明

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