insertsort.h

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

H
27
字号
#include"Node.h"
using namespace std;
pNode insert (pNode L, pNode pNew)
{
  if (L == NULL)
    return pNew;
  if (pNew->data < L->data)
  {
      pNew->next = L;
      return pNew;
  }
  L->next = insert (L->next, pNew);
  return L;
}

pNode insertsort (pNode L)
{
  if (L == NULL) //空链,无须排序,返回.(递归的跳出条件)
    return L;
  pNode tail = L->next;
  L->next = NULL;
  return insert (insertsort(tail), L);
}



⌨️ 快捷键说明

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