以下图为例验证算法
main.cpp
#include <stdio.h>
#include <malloc.h>
#include "graph.h"
#define MaxSize 100
typedef struct
{
int u; //边的起始顶点
int v; //边的终止顶点
int w; //边的权值
} Edge;
void InsertSort(Edge E[],int n) //对E[0..n-1]按递增有序进行直接插入排序
{
int i,j;
Edge temp;
for (i=1; i<n; i++)
{
temp=E[i];
j=i-1; //从右向左在有序区E[0..i-1]中找E[i]的插入位置