difference(OtherLinkedList, diff) {
        if (this.size() !== OtherLinkedList.size()) { //determine if there is addition or deletion
            if (this.size() < OtherLinkedList.size())
                diff.linkedListForStep.size = JSON.stringify({ addNodes: this.size(), To: OtherLinkedList.size() });
            else {
                diff.linkedListForStep.size = JSON.stringify({ removeNodes: this.size(), To: OtherLinkedList.size() });
            }
        } else { //same size but different nodes
            for (var i = 0; i < this.size(); i++) {
                if (!this.getNode(i).equals(OtherLinkedList.getNode(i))) {
                    diff.linkedListForStep.node = {};
                    diff = this.getNode(i).difference(OtherLinkedList.getNode(i), diff, i);
                }
            }
        }
        return diff;
    }
/**
     * Calculats the difference between this linked list and the other linkedlist
     * @param {LinkedList} OtherLinkedList The other linked list that will be compared with this linked list
     * @param {Hash} diff Hash table
     */
Calculats the difference between this linked list and the other linkedlist
@param {LinkedList} OtherLinkedList The other linked list that will be compared with this linked list
@param {Hash} diff Hash table
Calculats the difference between this linked list and the other linkedlist @param { LinkedList } OtherLinkedList The other linked list that will be compared with this linked list @param { Hash } diff Hash table
difference(OtherLinkedList, diff) {
        if (this.size() !== OtherLinkedList.size()) { 
            if (this.size() < OtherLinkedList.size())
                diff.linkedListForStep.size = JSON.stringify({ addNodes: this.size(), To: OtherLinkedList.size() });
            else {
                diff.linkedListForStep.size = JSON.stringify({ removeNodes: this.size(), To: OtherLinkedList.size() });
            }
        } else { 
            for (var i = 0; i < this.size(); i++) {
                if (!this.getNode(i).equals(OtherLinkedList.getNode(i))) {
                    diff.linkedListForStep.node = {};
                    diff = this.getNode(i).difference(OtherLinkedList.getNode(i), diff, i);
                }
            }
        }
        return diff;
    }
difference ( OtherLinkedList , diff ) { if ( this . size ( ) !== OtherLinkedList . size ( ) ) { if ( this . size ( ) < OtherLinkedList . size ( ) ) diff . linkedListForStep . size = JSON . stringify ( { addNodes : this . size ( ) , To : OtherLinkedList . size ( ) } ) ; else { diff . linkedListForStep . size = JSON . stringify ( { removeNodes : this . size ( ) , To : OtherLinkedList . size ( ) } ) ; } } else { for ( var i = 0 ; i < this . size ( ) ; i ++ ) { if ( ! this . getNode ( i ) . equals ( OtherLinkedList . getNode ( i ) ) ) { diff . linkedListForStep . node = { } ; diff = this . getNode ( i ) . difference ( OtherLinkedList . getNode ( i ) , diff , i ) ; } } } return diff ; }
Calculats the difference between this linked list and the other linkedlist
 @param {LinkedList} OtherLinkedList The other linked list that will be compared with this linked list
 @param {Hash} diff Hash table
Calculats the difference between this linked list and the other linkedlist @param { LinkedList } OtherLinkedList The other linked list that will be compared with this linked list @param { Hash } diff Hash table
//determine if there is addition or deletion //same size but different nodes