insert a data at the tail of the doubly linked list

PHOTO EMBED

Wed Jul 17 2024 16:11:36 GMT+0000 (Coordinated Universal Time)

Saved by @vishnu_jha #c++ #dsa #linkedlist #insertinlast #print #insertinbetween #insertatposition #insertinmiddle #doublylinkedlist #insertathead

void insertAtTail(node *&tail, node* &head, int d) {
  node *temp = new node(d);
  if (tail == NULL) {
    tail = head = temp;
  } else {
    tail->next = temp;
    temp->prev = tail;
    tail = temp;
  }
}
content_copyCOPY

https://youtu.be/q8gdBn9RPeI?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA