Created
September 21, 2015 14:49
-
-
Save tanvir002700/d38849519a065084a906 to your computer and use it in GitHub Desktop.
Linked List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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