#include
using namespace std;
struct ListNode
{
int num;
ListNode *next;
};
ListNode *create(int n)
{ListNode *p,*tail=0,*head=0;
for(int j=0;j
{p=new ListNode;cin>>p->num;
p->next=0;
if(head==0)head=p;
else tail->next=p;
tail=p;
}
return head;
}
void Bubble_sort(int n)
{ListNode *now=0,*ne=0,*tail=0,*head=0;
int temp;
head=tail=create(n);
for(int i=1;i
{tail=head;
for(int j=1;j
{now=tail;
ne=tail->next;
if((now->num)>(ne->num))
{
temp=(now->num);
(now->num)=(ne->num);
(ne->num)=temp;
tail=tail->next;
}
}
}
tail=head;
for(int k=0;k
{
coutnum<<' ';
tail=tail->next;
}
}
int main()
{
int leng;
cin>>leng;
Bubble_sort(leng);
}