Data Structure:Deleting a node in linked list,Recursive approach in C programming

Hackerrank problem 5:Data Structure:Deleting a node in linked list,Recursive approach in C programming

In our Programming website about computer coding for free online in data structures and alogorithms in c,java,python etc we try solve progaming,computer coding in easy way with best programming resources.
Here I use recursive approach to solve this;I only wrote the function in this case;the code is as follows:
/ this is solution function


/ Prerequsite:
Node
{
int data;
Node* link;
};
Node* deleteNode(Node* root, int pos) {

if(pos==0)
{
return root->link;
}
root->link=deleteNode(root->link, pos-1);
return root;

}
/Here pos means position

Post a Comment

0 Comments