Delete node in Doubly Linked List
Submissions: 11300   Accuracy:

48.28%

  Difficulty: Basic   Marks: 1
Associated Course(s):   Sudo Placement 2019

Delete a node from given position in a doubly linked list.

Input:

In this problem, method takes two argument: the address of the head of the linked list and the node you have to delete . The function should not read any input from stdin/console.
The Node structure has a data part which stores the data and a next pointer which points to the next element of the linked list. 
There are multiple test cases. For each test case, this method will be called individually.

Output:

Delete the node from the given doubly linked list and set *head_ref if required .

Constraints:
1<=T<=300
2<=N<=100
1<=x<=N

Example:

Input:
2
3                        //Size of Linked List
1  3 4                 //Elements of Linked List
3                        //Location of element to be deleted
4
1 5 2 9                    
1

Output:
1 3           
5 2 9

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Amit Khandelwal, Harshit Sidhwa
Author: bhawnamait


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.