typedef struct tagTList
{
int m_nKey;
struct tagTList *m_pNext;
tagTList(void)
{
m_nKey = 0;
m_pNext = NULL;
}
tagTList(int nValue)
{
m_nKey = nValue;
m_pNext = NULL;
}
}TList;
void CreateList(TList* &h, int n)
{
TList *pTemp = NULL, *pIT:
h = new TList();
pIT = h;
for (int i=0; i
pTemp = new TList(i+1);
p->m_pNext = pTemp;
p = pTemp;
}
}
//很简单的,你应该要看明白,看不明白再问。
struct node
{
int key;
node *next;
} *h=NULL;
void init(int n)
{
int i=1;
node *p;
node *q;
while(i<=n)
{
p=new node;
p->key=i;
p->next=NULL;
if(h==NULL)
h=p;
else
q->next=p;
q=p;
i++;
}
}
diu nei