#include <stdio.h>
#define ElemType int
int main(int argc, char **argv) {
printf("Hello, World!\n");
typedef struct LNode{
ElemType data;
struct LNode *next
}LNode,*LinkList;
bool InitList(LinkList &L)
{
L=NULL;
return true;
}
void test()
{
LinkList L;
InitList(L);
}
bool Empty(LinkList L)
{
return (L==NULL);
}
bool InitList(LinkList &L)
{
L=(LNode*)malloc(sizeof(LNode));
if(L==NULL)return false;
L->next=NULL;
return true;
}
void test()
{
LinkList L;
InitList(L);
}
bool Empty(LinkList L)
{
if(L->next==NULL)return true;
else return false;
}
LNode * GetElem(LinkList L,int i)
{
if(i<0)return NULL;
LNode *p;
int j=0;
p=L;
while(p!=NULL&&j<i)
{
p=p->next;
j++;
}
return p;
}
LNode * LocationElem(LinkList L,int e)
{
LNode *p=L->next;
while(p!=NULL&&p->data!=e)
p=p->next;
return p;
}
int Length(LinkList L)
{
int len=0;
LNode *p=L;
while(p->next!=NULL)
{
len++;
p=p->next;
}
return len;
}
bool InsertPriorNode(LNode *p,ElemType e)
{
if(p==NULL)return false;
LNode *s=(LNode *)malloc(sizeof(LNode));
if(s=NULL) return false;
s->next=p->next;
p->next=s;
s->data=p->data;
p->date=e;
return true;
}
}