wordpress连接数据库嘉兴网站的优化
- 作者: 多梦笔记
- 时间: 2026年02月18日 23:16
当前位置: 首页 > news >正文
wordpress连接数据库,嘉兴网站的优化,网站分为那几个模块,解决wordpress后台卡顿单向链表 typedef int datatype; //由于有效数据不一定是正数#xff0c;所以将数据重命名。typedef struct lklst{ //不能是无名结构体了#xff0c;因为定义指针域的时候需要使用union{int len; //头结点时候使用#xff1b;datatype data; … 单向链表 typedef int datatype; //由于有效数据不一定是正数所以将数据重命名。typedef struct lklst{ //不能是无名结构体了因为定义指针域的时候需要使用union{int len; //头结点时候使用datatype data; //有效数据结点时候使用}text; //数据域存储数据struct lklst *next; //指针域指向下一个结点存储下一个结点的首地址 }Linklist; 创建空的单链表 Linklist * createlinklist(void){//在堆空间中申请头结点//判断是否生成 成功Linklist link(Linklist) malloc(sizeof(Linklist));//malloc申请堆空间返回的是void*类型所以需要强转成需要的类型if(link NULL){printf(堆空间申请失败);return NULL;}link-nextNULL;link-text.len0;return link; } 头插 //头插法插入数据 void insert_linklistByHead(Linklist *head,datatype data){//创建节点Linklist * temp(Linklist*) malloc(sizeof(Linklist));if(temp NULL){printf(堆空间申请失败);return ;}temp-nextNULL;temp-text.datadata;//temp-nexthead-next;head-nexttemp;//更新头节点数据的长度head-text.len;return; } 尾插 //尾插法插入数据 void insert_linklistByEnd(Linklist *head,datatype data){//创建节点Linklist * temp(Linklist*) malloc(sizeof(Linklist));if(temp NULL){printf(堆空间申请失败);return ;}temp-nextNULL;temp-text.datadata;Linklist * read head;//找到尾节点while(read-next!NULL){read read-next;}read-nexttemp;//更新长度head-text.len; } 按位置插入 //按位置插入 void insert_linklistByPosition(Linklist *head,datatype data,int n) {if (n 1) {printf(非法数据\n);return;}Linklist *p head;for (int i0;in-1;i) {pp-next;if(pNULL){printf(非法数据\n);return;}}Linklist * temp(Linklist*) malloc(sizeof(Linklist));if(temp NULL){printf(堆空间申请失败);return ;}temp-text.datadata;temp-next NULL; //将temp插入到p结点的后一个位置temp-nextp-next;temp-text.datadata;p-nexttemp;//更新长度head-text.len;return; } 头删 void delete_linklistByHead(Linklist *head){//判断链表是否为空if(head-nextNULL)return;//先将要释放的结点地址另存Linklist * temp head-next;//要释放结点中存储下一个结点的地址给头结点head-nexttemp-next;//释放结点free(temp);tempNULL;//更新长度head-text.len–;return ; } 尾删 //尾删 void delete_linklistByEnd(Linklist *head){//判断链表是否为空if(head-nextNULL)return;//寻找倒数第二个结点Linklist * temp head;while(temp-next-next ! NULL) {temp temp-next;}//释放结点free(temp-next);temp-next NULL;//更新长度head-text.len–; } 按位置删除 //按位置删除 void delete_linklistByPosition(Linklist head,int n){if(head-nextNULL){printf(非法数据\n);return;}if(n1){printf(非法数据\n);return;}//找到要删除结点的前一个节点位置Linklist p head;for(int i0;in-1;i)pp-next;if(NULL p-next){printf(n%d删除位置非法\n,n);return;}//能运行到这个位置则说明p指向的是要删除的结点的前一个位置Linklist* temp p-next;p-next temp-next;free(temp);temp NULL;//更新长度head-text.len;return ; } 遍历链表 //遍历链表 void Iterative_list(Linklist *head){//读头节点的数据Linklist * read head;while(read-next!NULL){read read-next;datatype data read-text.data;printf(%d\t,data);}putchar(10); } 单向循环链表 typedef int datatype; //由于有效数据不一定是正数所以将数据重命名。typedef struct loopklst{ //不能是无名结构体了因为定义指针域的时候需要使用union{int len; //头结点时候使用datatype data; //有效数据结点时候使用}text; //数据域存储数据struct loopklst *next; //指针域指向下一个结点存储下一个结点的首地址 }LoopLinklist; //创建一个空的单链表 LoopLinklist * create_recurringlinklist(void) {LoopLinklist * head (LoopLinklist *) malloc(sizeof(LoopLinklist));if (NULL head){printf(单向循环链表创建失败\n);return NULL;}head-text.len 0;//头结点中记录的链表长度赋值为0head-next head;//将指针域指向自己return head; } 头插 //头插 void insert_recurringlinklistByHead(LoopLinklist *head,datatype data){//创建节点LoopLinklist * temp(LoopLinklist*) malloc(sizeof(LoopLinklist));LoopLinklist * phead;if(temp NULL){printf(堆空间申请失败);return ;}temp-text.datadata;temp-nextp-next;head-nexttemp;//更新头节点数据的长度head-text.len;return; } 尾插 //尾插 void insert_recurringlinklistByEnd(LoopLinklist *head,datatype data){LoopLinklist *temp(LoopLinklist *) malloc(sizeof (LoopLinklist ));if(tempNULL){printf(创建失败);return;}LoopLinklist * pNULL;phead;while(p-next!head){pp-next;}temp-nexthead;temp-text.datadata;p-nexttemp;head-text.len;return; } 按位置插入 void insert_recurringlinklistByPosition(LoopLinklist *head,datatype data,int n){if (n 1) {printf(非法数据\n);return;}LoopLinklist *p head;for (int i0;in-1;i) {pp-next;if(pNULL){printf(非法数据\n);return;}}LoopLinklist * temp(LoopLinklist*) malloc(sizeof(LoopLinklist));if(temp NULL){printf(堆空间申请失败);return ;}temp-text.datadata;temp-next NULL;//将temp插入到p结点的后一个位置temp-nextp-next;temp-text.datadata;p-nexttemp;//更新长度head-text.len;return; } 头删 //头删 void delete_recurringlinklistByHead(LoopLinklist *head){LoopLinklist *temphead-next;if(head-nexthead){printf(链表为空删除失败);return;}temptemp-next;free(head-next);head-nexttemp;return; } 尾删 //尾删 void delete_recurringlinklistByEnd(LoopLinklist *head){//判断链表是否为空LoopLinklist *phead;if(head-nexthead){printf(链表为空);return;}//找到倒数第二个结点while(p-next-next!head){pp-next;}//free(p-next);p-nexthead;//更新长度head-text.len–;return; } 按位置删除 //位置删除 void delete_recurringlinklistByPosition(LoopLinklist head,int n){if(head-nexthead){printf(非法数据\n);return;}if(n1){printf(非法数据\n);return;}//找到要删除结点的前一个节点位置LoopLinklist p head;for(int i0;in-1;i)pp-next;if(p-nexthead){printf(n%d删除位置非法\n,n);return;}//能运行到这个位置则说明p指向的是要删除的结点的前一个位置LoopLinklist* temp p-next;p-next temp-next;free(temp);temp NULL;//更新长度head-text.len;return ; } 遍历链表 //遍历循环单向链表 void Iterative_recurringlinklist(LoopLinklist *head){//读头节点的数据LoopLinklist * read head;while(read-next!head){read read-next;datatype data read-text.data;printf(%d\t,data);}putchar(10); } 双向链表 typedef int datatype; //由于有效数据不一定是正数所以将数据重命名。typedef struct Dublinklist{ //不能是无名结构体了因为定义指针域的时候需要使用union{int len; //头结点时候使用datatype data; //有效数据结点时候使用}text; //数据域存储数据struct loopklst *prev; //指针域指向上一个结点存储上一个结点的首地址struct loopklst *next; //指针域指向下一个结点存储下一个结点的首地址 }Dublist; Dublist * create_Dublinklist(void){//判断是否生成 成功Dublist link(Dublist) malloc(sizeof(Dublist));//malloc申请堆空间返回的是void*类型所以需要强转成需要的类型if(link NULL){printf(堆空间申请失败);return NULL;}link-prevNULL;link-nextNULL;link-text.len0;return link; } 头插 void insert_DublistByHead(Dublist *head,datatype data){Dublist *temp(Dublist *) malloc(sizeof (Dublist));if(tempNULL){printf(堆空间申请失败);return;}Dublist *phead;temp-text.datadata;//nexttemp-nexthead-next;head-nexttemp;//prvetemp-prevhead;if(temp-next!NULL){temp-next-prevtemp;}head-text.len;return; } 尾插 void insert_DublistByEnd(Dublist *head,datatype data){Dublist *temp(Dublist *) malloc(sizeof (Dublist));if(tempNULL){printf(堆空间申请失败);return;}Dublist *phead;temp-text.datadata;//找尾部的位置while(p-next!NULL){pp-next;}//nexttemp-nextp-next;p-nexttemp;//prvetemp-prevp;//更新长度head-text.len;return; } 按位置插入 //按位置插入 void insert_DublistByPosition(Dublist *head,datatype data,int n) {if (n 1) {printf(非法数据\n);return;}Dublist *p head;for (int i0;in-1;i) {pp-next;if(pNULL){printf(非法数据\n);return;}}Dublist * temp(Dublist*) malloc(sizeof(Dublist));if(temp NULL){printf(堆空间申请失败);return ;}temp-text.datadata;temp-next NULL; //将temp插入到p结点的后一个位置temp-nextp-next;temp-text.datadata;p-nexttemp;//更新长度head-text.len;return; } 头删 //头删 void delete_DublistByHead(Dublist *head){if(head-nextNULL){printf(非法数据\n);return;}Dublist * temphead-next;head-nexttemp-next;head-next-prevhead;free(temp);tempNULL;return; } 尾删 void delete_DublistByEnd(Dublist *head){Dublist * phead;//判断链表是否为空if(head-nextNULL)return;//寻找倒数第二个结点Dublist * temp head;while(temp-next-next ! NULL) {temp temp-next;}//释放结点free(temp-next);temp-next NULL;//更新长度head-text.len–;return; } 按位置删除 //按位置删除 void delete__DublistByPosition(Dublisthead,int n){if(head-nextNULL){printf(非法数据\n);return;}if(n1){printf(非法数据\n);return;}//找到要删除结点的前一个节点位置Dublist p head;for(int i0;in-1;i)pp-next;if(NULL p-next){printf(n%d删除位置非法\n,n);return;}//能运行到这个位置则说明p指向的是要删除的结点的前一个位置Dublist* temp p-next;p-next temp-next;free(temp);temp NULL;//更新长度head-text.len;return ; }
相关文章
-
wordpress类似网站模板wordpress 新主题
wordpress类似网站模板wordpress 新主题
- 站长
- 2026年02月18日
-
wordpress老网站重装法怎么做浏览器网站
wordpress老网站重装法怎么做浏览器网站
- 站长
- 2026年02月18日
-
wordpress可以删除版权么佛山百度提升优化
wordpress可以删除版权么佛山百度提升优化
- 站长
- 2026年02月18日
-
wordpress留言板页面南宁seo营销推广
wordpress留言板页面南宁seo营销推广
- 站长
- 2026年02月18日
-
wordpress论坛主题搜索引擎优化实验报告
wordpress论坛主题搜索引擎优化实验报告
- 站长
- 2026年02月18日
-
wordpress没了seo网络推广公司排名
wordpress没了seo网络推广公司排名
- 站长
- 2026年02月18日
