Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove duplicate Node

/* amethod to use in class LinkedList
to remove duplicate node*/
        removeDuplicate() {

            if (this.head) {
                let current = this.head;
        while (current.next != null) {
            if (current.value == current.next.value)
                current.next = current.next.next;
            else
                current = current.next;
        }
    }
        return this;
    }
  
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #duplicate #Node
ADD COMMENT
Topic
Name
9+2 =