文章
16
粉丝
134
获赞
0
访问
11.1k
#include<bits/stdc++.h>
using namespace std;
struct node {
int n;
struct node *next;
};
//创建循环链表
struct node * create(int n) {
struct node* head = (struct node*)malloc(sizeof(struct node));
head->next = NULL;
struct node * p = head;
for(int i = 1; i <= n; i++) {
struct node* now = (struct node*)malloc(sizeof(struct node));
if(i == 1) {
head = now;
p = now;
}
now->n = i;
now->next = head;
p->next = now;
p = now;
}
return head;
}
void print(struct node*head) {
struct node*p = head->next;
int i = 1;
while(p-&g...
登录后发布评论
暂无评论,来抢沙发