Skip to content

Instantly share code, notes, and snippets.

@tanvir002700
Created September 21, 2015 14:49
Show Gist options
  • Save tanvir002700/d38849519a065084a906 to your computer and use it in GitHub Desktop.
Save tanvir002700/d38849519a065084a906 to your computer and use it in GitHub Desktop.
Linked List
void Delete(int pos)
{
node *temp,*left,*right;
if(pos==0)
{
Size--;
temp=Head;
Head=Head->next;
delete(temp);
return;
}
int p=0;
temp=Head;
while(temp!=NULL and p<pos)
{
left=temp;
temp=temp->next;
p++;
}
if(temp==NULL)return;
Size--;
if(temp->next==NULL)
{
left->next=NULL;
tail=left;
delete(temp);
return;
}
right=temp->next;
left->next=right;
delete(temp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment