select.h

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

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

pNode SelectLinkListSort(pNode head)
{       pNode tmp = head->next;
       for (;tmp->next != NULL;tmp = tmp->next)
       {
              int min = tmp->data;
              pNode n = tmp;
              for (pNode node = tmp->next; node != NULL; node = node->next)
              {
                     if (node->data <=min)
                     {
                            n = node;
                            min = node->data;
                     }
              }
              //交换信息
              int t = tmp->data;
              tmp->data = n->data;
              n->data = t;
       }
       return head;
}

⌨️ 快捷键说明

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