bubble.h

来自「对链表进行排序 应用了多种排序方法 对其进行比较 有自己的详细的时间函数」· C头文件 代码 · 共 21 行

H
21
字号
#include"Node.h"
using namespace std;

pNode BubbleLinkListSort(pNode head)
{
       pNode tmp = head->next;
       for (;tmp->next != NULL;tmp = tmp->next)
       {
              for (pNode node = head->next; node->next != NULL; node = node->next)
              {
                     if (node->data > node->next->data)
                     {
                            int t = node->data;
                            node->data = node->next->data;
                            node->next->data = t;                
                     }
              }
       }
       return head;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?