sp-linked-list

https://practice.geeksforgeeks.org/tracks/sp-linked-list/?batchId=152

Problems

Print Linked List elements Solved on: April 20, 2020

void display(Node *head)
{
    while (head != NULL) {
        cout << head->data << " ";
        head = head->next;
    }
}

Linked List Insertion Solved on: April 20, 2020

// function inserts the data in front of the list
Node *insertAtBegining(Node *head, int newData) {
   
   struct Node *temp=new Node(newData);
   if (head == NULL) {
       head = temp;
   } else {
       temp->next = head;
       head = temp;
   }
   return head;
}


// function appends the data at the end of the list
Node *insertAtEnd(Node *head, int newData)  {
   
   struct Node *newNode =new Node(newData);
   Node *temp=head;
   
   if (head == NULL) {
       head = newNode;
   } else {
       while (temp->next !=NULL) {
           temp=temp->next;
       }
       temp->next = newNode;
   }
   return head;

}

Delete a Node in Single Linked List Solved on: April 20, 2020

Count nodes of linked list Solved on: April 20, 2020

Node at a given index in linked list Solved on: April 20, 2020

Finding middle element in a linked list Solved on: April 20, 2020

Reverse a linked list Solved on: 21st April 2020

Detect Loop in linked list Solved on: 21st April 2020

Remove loop in Linked List Solved on: 21st April 2020

Rotate a Linked List Solved on: 21st April 2020

Delete node in Doubly Linked List Solved on: 23rd April 2020

Remove duplicates from an unsorted linked list Solved on: April 24th 2020

Merge two sorted linked lists Learnt on: 21st July 2020

Intersection Point in Y Shapped Linked Lists Solved on: 21st July 2020

Pairwise swap elements of a linked list Solved on: Jul 22nd 2020

Last updated

Was this helpful?