操作系统
1月13日 周六
实现的功能: 快速排序 创建单链表
/* Note:Your choice is C IDE */
include “stdio.h”
//快速排序
int part(int a[],int low,int high)
{
int key;
//记录第一个下标的值
//以第一个下标为支点
key=a[low];
while(low
include “stdio.h”
//单链表5个节点
struct node
{
int data;
struct node *next;
};
void main()
{
struct node *head,*p,*s;
int e,i;
head=(struct node *)malloc(sizeof(struct node));
s=head;
//5
for(i=0;i<5;i++)
{
printf("%d:",i+1);
scanf("%d",&e);
p=(struct node *)malloc(sizeof(struct node));
p->data=e;
p->next=NULL;
s->next=p;
s=p;
}
s=head;
for(i=0;i<5;i++)
{
s=s->next;
printf("%d",s->data);
}
}
Never put your happiness in someone else’s hands.
永远不要把自己的幸福放到别人的手中。