//冒泡排序
void BubbleSort(Node *pHead,Node *pTail){
int count = SizeList(pHead, pTail);
Node *pMove;
pMove = pHead->next;
while (count > 1) {
while (pMove->next != pTail) {
if (pMove->element > pMove->next->element) {
//交换
int temp;
temp = pMove->element;
pMove->element = pMove->next->element;
pMove->next->element = temp;
}
pMove = pMove->next;
}
pMove = pHead->next;
count --;
}
printf("%s函数执行,链表的冒泡排序完成\n",__FUNCTION__);
}
void BubbleSort(Node *pHead,Node *pTail){
int count = SizeList(pHead, pTail);
Node *pMove;
pMove = pHead->next;
while (count > 1) {
while (pMove->next != pTail) {
if (pMove->element > pMove->next->element) {
//交换
int temp;
temp = pMove->element;
pMove->element = pMove->next->element;
pMove->next->element = temp;
}
pMove = pMove->next;
}
pMove = pHead->next;
count --;
}
printf("%s函数执行,链表的冒泡排序完成\n",__FUNCTION__);
}