Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

linked list delete nodes

  deleteAnyNode(value) {
    // contact me !!!
    // linkedIn account : https://www.linkedin.com/in/mohammad-alshraideh-67820b186/
    if (!this.head) return null;
    let current = this.head;

    while (current.next) {
      if (current.value == value) {
        current.value = current.next.value;
        current.next = current.next.next;
      }
      current = current.next;
    }
    return current;
  }
//if you find the answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Source by github.com #
 
PREVIOUS NEXT
Tagged: #linked #list #delete #nodes
ADD COMMENT
Topic
Name
7+3 =