
非常的简单,但是我刚刚学了可怕的链表,然后要试一下熟悉一下操作,然后我就被链表闷死了、冻死了、咬死了。所以急求啊
#include<bits/stdc++.h>
using namespace std;
struct Node{
int value;
Node *next;
}a[100001],*head;
int n;
int main() {
scanf("%d", &n);
head=NULL;
for(int i=1;i<=n;i++){
scanf("%d",&a[i].value);
}
for(Node *t=head;t;t=t->next){
for(Node *p=t->next;p;p=p->next){
if(t->value>p->value){
t->next=p->next;
p->next=t;
}
}
}
for(Node *p=head;p;p=p->next){
printf("%d ",p->value);
}
}
我想知道两根红线中间到底怎么添加节点啊啊啊 啊啊啊啊,只是单纯的添加一下,求求啦~~~~~~~~~~~!