Skip to main content

Deleting a Node by passing data in LInkedList

Deleting a Node by passing data in LInkedList:-

The node can be deleted by passing the data value in a function.Here we have three pointers one to traverse the list other to point current node and third one to point previous of current node.

//deleting a given key
 public Node deleteKeyNode(Node head,int key)
  //traverse pointer
  Node temp=head;
  //previous pointer
  Node prevtemp=temp;
   //when key is at head position
    System.out.println("head is deleted");
    return head;
   //when key is at any position other than head
  return head;



Popular posts from this blog

Topics to Start - preparing for Data Structures and Algorithms

Learn in a different way :- Strings stacks and queues heaps searching hash table sorting recursion dynamic programming greedy algorithms graphs tree Binary Search Tree Linked List Array Parallel programming and concurrency design problems system design availability and scalability  Below topics are good to have object oriented programming language details ( java , python) object oriented design tools ( bash , git , maven , jira , jenkins , docker , kubernetes) database

Best LeetCode Lists for Interviews

Here is a list of some of the best questions asked in interviews:-  Must do 75 Must do 60 Must do medium:- Must do Easy:- Graph:-  Dynamic Programming:-  FaceBook interviews:-  Amazon Interviews:-  Google Interviews:-