node.h

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

H
48
字号

#ifndef NODE
#define NODE
using namespace std;
struct Node
{
  Node* next;
  int data;
};
typedef struct Node* pNode;
pNode sCreate(int array[] , int len ) 
{
       int i= 1 ; 
       pNode pNewNode,pHead; 
       pNewNode = new Node ; 
       pHead = pNewNode ; 
       pNewNode->data = array[0] ;
       pNewNode->next = NULL ; 
       while( i <=len ) 
       { 
             pNewNode->next = new Node; 
             pNewNode = pNewNode->next ; 
             pNewNode->data = array[ i ] ; 
             pNewNode->next = NULL ; i++ ; 
       }
       return pHead ;
}
 
void sPrint(pNode pList) 
{ 
     while(pList!= NULL) 
     { 
        cout<< pList->data <<endl; 
        pList = pList->next ; 
     } 
     cout<< "now null" <<endl; 
}
pNode Locate(pNode pList,int n)
{
  pNode p=pList;
   for(int i=0;i<=n;i++)
     p=p->next;
     
   return p;
}
     
#endif 

⌨️ 快捷键说明

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