アルゴリズムを記述し,n個のキーワードの整数値をとるレコードシーケンスを整理し,すべてのキーワードが負の値であるレコードをキーワードが負の値でないレコードの前に並べる.


/*2018.11
*       - 8   T3     
*(4)    , n                 ,                           
*  :1.        ,               ;
      2.         o(n)(       )
*/
#include 
#include 
#include 

typedef int elemtype;

typedef struct
{
	elemtype *elem;
	int length;
}Sqlist;

void initList(Sqlist &list,int n)/*        */
{
	list.elem=new int[n+1];
	if(!list.elem)
		return;
	list.length=n;
}

void ListInsert(Sqlist &list,int i,int num)/*    */
{
	if(i<1)return;
	list.elem[i]=num;
}

void outputList(Sqlist list)/*         */
{
	for(int i=1;i<=list.length;i++)
	{
		printf("%4d",list.elem[i]);
		if(i%10==0)
			printf("
"); } printf("
"); } int partition(Sqlist &list,int low,int high)/* 1*/ { elemtype temp; list.elem[0]=list.elem[low]; temp=list.elem[low]; while(low=temp) --high; list.elem[low]=list.elem[high]; while(low