#include <iostream>
using namespace std;
typedef struct Node
{
int data;
struct Node* next;
}Node, *pNode;
pNode Init(int* a, int len)
{
int i;
pNode head, p, q;
head = new Node();
head->data = a[0];
q = head;
for (i = 1; i < len; ++i)
{
p = new Node();
p->data = a[i];
q->next = p;
q = p;
}
q->next = NULL;
return head;
}
void printList(pNode p)
{
while(p)
{
cout<<p->data<<" ";
if (p->next)
{
p = p->next;
}
......
阅读全文