List MakeEmpty(){
List head = (List)malloc(sizeof(List));
head->Next = NULL;
return head;
}
Position Find( List L, ElementType X ){
List head = L->Next;
while(head){
if(head->Data == X){
return head;
}
head = head->Next;
}
return ERROR;
}
bool Insert( List L, ElementType X, Position P ){
List head = L;
while(head){
if(head->Next == P){
List Node = (List)malloc(sizeof(List));
Node->Data = X;
Node->Next = head->Next;
head->Next = Node;
return true;
}
head = head->Next;
}
printf("Wrong Position for Insertion\n");
return false;
}
bool Delete( List L, Position P ){
List head = L;
while(head){
if(head->Next == P){
head->Next = head->Next->Next;
return true;
}
head = head->Next;
}
printf("Wrong Position for Deletion\n");
return false;
}
07-17
1138