free(p);Р if(S2 == NULL)?//组合已到末尾重头继续开始合并Р {?S1 = S.next;Р S2 = S1->next;Р }Рprintf("\n******************第%d次合并*********************", i++);Р OutputList(L);Р?}Р}Р4.4两路冒泡排序Р 本算法是对冒泡排序算法的改进算法。Р/*两路冒泡排序*/РSqList TwinBubbleSort(SqList L)Р{Р int i,j,k,l;Р?int exchangeMAX, exchangeMIN;?//是否发生交换标记Р int tmp;?//交换临时变量Р for(i=0; i<L.length-1; i++)Р { //冒泡出一个最大数Р exchangeMAX = 0;Р j = i;Р while(j < L.length-1-i)?Р { if(L.data[j] > L.data[j+1])?//找到位置! 交换(找最大) Р { exchangeMAX = 1;Р tmp = L.data[j];Р L.data[j] = L.data[j+1];Р L.data[j+1] = tmp;Р }Р j++;Р }Р if(exchangeMAX == 0)Р return L;Р //冒泡出一个最小数Р exchangeMIN = 0;Р k = i; //起始下标Р l = L.length-1-i-1;?Р while(k < l)Р {?if(L.data[l] < L.data[l-1])?//找到位置! 交换(找最小) Р {Р exchangeMIN = 1;Р tmp = L.data[l];Р L.data[l] = L.data[l-1];Р L.data[l-1] = tmp;Р }