直接插入排序

#include "stdio.h"
#include "malloc.h"
#define MAX 100
typedef int keyType;
typedef int DateType;
typedef struct
{
    int key;
    int info;
}RecordNode;
typedef struct
{
    RecordNode record[MAX];
    int n;
}SortObject;
void insert(SortObject *pvector)
{
    int i,j;
    RecordNode temp;
    for(i=1;i<pvector->n;i++);
    {
        temp=pvector->record[i];
        while((temp.key<pvector->record[j].key)&&(j>=0))
        {
            pvector->record[j+1]=pvector->record[j];
            j--;
        }
    }
    if(j!=i-1) pvector->record[j+1]=temp;
}
int main()
{

}

你可能感兴趣的:(J#)