网龙笔试题:
1、实现链表的
创立,删除和逆序等。
#include<iostream>
#include<assert.h>
using namespace std;
typedef struct stu
{int data;
struct stu *next;
}node, list;
node* creatlist(int n)
{node *h, *p, *s;
h = new node;
h->next = NULL;
p = h;
cout << “please input
〞<< n <<
〞numbers.
〞;for(int i = 0; i < n; i++)
{s= new node;
cin >> s->data;
s->next = NULL;
p->next = s;
p = s;
}return h;
}void deletelist (node *s, int a)
{node *p;
while(s->data != a)
{p = s;
s = s->next;
}if(s == NULL)
{cout << “no a
〞;}else
{p->ne ...


雷达卡


京公网安备 11010802022788号







