当前位置: 首页 > news >正文

北京网站建设成都公司网络营销这个专业怎么样

北京网站建设成都公司,网络营销这个专业怎么样,福建省人民政府官网,自助建站最好的平台实现功能BuySListNode ————————————申请一个新节点并赋值SListLength —————————————计算链表的长度SListPushBack————————————尾插SListPushFront————————————头插SListPopBack—————————————尾删SListPopFront—…

实现功能

BuySListNode ————————————申请一个新节点并赋值

SListLength —————————————计算链表的长度

SListPushBack————————————尾插

SListPushFront————————————头插

SListPopBack—————————————尾删

SListPopFront————————————头删

SListFindByVal————————————按值查找链表

SListFindByPos————————————按位置查找链表

SListInsertAfter————————————任意位置插入

SListEraseAfter————————————任意位置删除

SListPrint——————————————打印链表

SList.h

#pragma once#define _CRT_SECURE_NO_WARNINGS 1#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>typedef int SLTDataType;typedef struct SLTNode
{SLTDataType data;struct SLTNode* next;
}SLTNode;//申请一个新节点并赋值
extern SLTNode* BuySListNode(SLTDataType x);//计算链表的长度
extern int SListLength(SLTNode* phead);//尾插
extern void SListPushBack(SLTNode** pphead, SLTDataType x);//头插
extern void SListPushFront(SLTNode** pphead, SLTDataType x);//尾删
extern void SListPopBack(SLTNode** pphead);//头删
extern void SListPopFront(SLTNode** pphead);//按值查找链表
extern SLTNode* FindByVal(SLTNode* phead, SLTDataType x);
extern void SListFindByVal(SLTNode* phead, SLTDataType x);//按位置查找链表
void FindByPos(SLTNode* phead, int pos, SLTNode** pp_aim1, int* p_aim2);
extern void SListFindByPos(SLTNode* phead, int pos);//任意位置插入
extern void SListInsertAfter(SLTNode** pphead, int pos, SLTDataType x);//任意位置删除
extern void SListEraseAfter(SLTNode** pphead, int pos);//打印链表
extern void SListPrint(SLTNode* phead);

SList.c

#include "SList.h"SLTNode* BuySListNode(SLTDataType x)
{SLTNode* newnode = (SLTNode*)malloc(sizeof(SLTNode));if (!newnode){perror("create newnode");exit(-1);}newnode->next = NULL;newnode->data = x;return newnode;
}int SListLength(SLTNode* phead)
{SLTNode* tail = phead;int count = 0;for (count = 1; tail->next != NULL; ++count){tail = tail->next;}return count;
}bool CheckEmpty(SLTNode* phead)
{return (phead) ? false : true;
}void SListPushBack(SLTNode** pphead, SLTDataType x)
{if (CheckEmpty(*pphead)){*pphead = BuySListNode(x);}else{SLTNode* tail = *pphead;while (tail->next){tail = tail->next;}tail->next = BuySListNode(x);}
}void SListPushFront(SLTNode** pphead, SLTDataType x)
{SLTNode* newnode = BuySListNode(x);newnode->next = *pphead;*pphead = newnode;
}void SListPopBack(SLTNode** pphead)
{if (CheckEmpty(*pphead)){printf("SList is empty!\n");return;}//注意仅存有一个节点的情况if (!(*pphead)->next){free(*pphead);*pphead = NULL;}//寻找前一个节点else{SLTNode* tail = *pphead;while (tail->next->next){tail = tail->next;}free(tail->next);tail->next = NULL;}
}void SListPopFront(SLTNode** pphead)
{if (CheckEmpty(*pphead)){printf("SList is empty!\n");return;}SLTNode* ret = *pphead;*pphead = (*pphead)->next;free(ret);
}SLTNode* FindByVal(SLTNode* phead, SLTDataType x)
{SLTNode* cur = phead;while (cur){if (cur->data == x){return cur;}elsecur = cur->next;}return NULL;
}
void SListFindByVal(SLTNode* phead, SLTDataType x)
{SLTNode* pos = FindByVal(phead, x);if (!pos){printf("Don't find it!\n");return;}//进行多次查找int i = 1;while (pos){printf("第%d个pos节点:%p->%d\n", i++, pos, pos->data);pos = FindByVal(pos->next, x);}
}void FindByPos(SLTNode* phead, int pos, SLTNode** pp_aim1, int* p_aim2)
{if (pos < 0 || pos > SListLength(phead)){printf("The position is illegal!\n");}else{SLTNode* tail = phead;//注意循环只需进行pos-1,所以使用--poswhile (--pos){tail = tail->next;}*pp_aim1 = tail;*p_aim2 = tail->data;}
}
void SListFindByPos(SLTNode* phead, int pos)
{SLTNode* aim1;int aim2 = 0;FindByPos(phead, pos, &aim1, &aim2);printf("%d号节点:%p->%d\n", pos, aim1, aim2);
}void SListInsertAfter(SLTNode** pphead, int pos, SLTDataType x)
{if (pos < 0 || pos > SListLength(*pphead)){printf("The position is illegal!\n");}else{if (*pphead == NULL){*pphead = BuySListNode(x);}else if ((*pphead)->next == NULL){(*pphead)->next = BuySListNode(x);}else{SLTNode* dest = *pphead;while (--pos){dest = dest->next;}SLTNode* newnode = BuySListNode(x);newnode->next = dest->next;dest->next = newnode;}}
}void SListEraseAfter(SLTNode** pphead, int pos)
{if (pos <= 0 || pos >= SListLength(*pphead)){printf("The position is illegal!\n");}else{SLTNode* prev = *pphead;while (--pos){prev = prev->next;}SLTNode* afet = prev->next->next;free(prev->next);prev->next = afet;}
}void SListPrint(SLTNode* phead)
{if (CheckEmpty(phead)){printf("SList is empty!\n");return;}SLTNode* tail = phead;while (!tail == NULL){printf("%d->", tail->data);tail = tail->next;}printf("NULL\n");
}

test.c

#include "SList.h"void test1()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);
}void test2()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPrint(pList);
}void test3()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPopBack(&pList);SListPrint(pList);
}void test4()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);SListPopFront(&pList);SListPopFront(&pList);SListPopFront(&pList);SListPopFront(&pList);SListPrint(pList);SListPopFront(&pList);SListPrint(pList);
}void test5()
{SLTNode* pList = NULL;SListPushFront(&pList, 3);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 3);SListPushFront(&pList, 1);SListPrint(pList);SListFindByVal(pList, 3);
}void test6()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);SListFindByPos(pList, 5);}void test7()
{SLTNode* pList = NULL;SListPushFront(&pList, 1);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPrint(pList);SListInsertAfter(&pList, 1, 2);SListPrint(pList);
}void test8()
{SLTNode* pList = NULL;SListPushFront(&pList, 2);SListPushBack(&pList, 3);SListPushBack(&pList, 4);SListPushBack(&pList, 5);SListPushFront(&pList, 1);SListPrint(pList);SListEraseAfter(&pList, 1);SListEraseAfter(&pList, 1);SListEraseAfter(&pList, 1);SListEraseAfter(&pList, 1);SListEraseAfter(&pList, 0);SListPrint(pList);
}void main()
{test1();printf("-------------------------------\n");test2();printf("-------------------------------\n");test3();printf("-------------------------------\n");test4();printf("-------------------------------\n");test5();printf("-------------------------------\n");test6();printf("-------------------------------\n");test7();printf("-------------------------------\n");test8();printf("-------------------------------\n");
}

文章转载自:
http://espiegle.mzpd.cn
http://mellowly.mzpd.cn
http://delores.mzpd.cn
http://drillstock.mzpd.cn
http://hansard.mzpd.cn
http://unworkable.mzpd.cn
http://massage.mzpd.cn
http://duodenotomy.mzpd.cn
http://camellia.mzpd.cn
http://triphibious.mzpd.cn
http://niche.mzpd.cn
http://neurotropism.mzpd.cn
http://medroxyprogesterone.mzpd.cn
http://invoke.mzpd.cn
http://aeolipile.mzpd.cn
http://decohesion.mzpd.cn
http://endometriosis.mzpd.cn
http://disinvite.mzpd.cn
http://opern.mzpd.cn
http://bottine.mzpd.cn
http://iberia.mzpd.cn
http://cacodyl.mzpd.cn
http://piggyback.mzpd.cn
http://numismatic.mzpd.cn
http://moonscape.mzpd.cn
http://trichinosed.mzpd.cn
http://muton.mzpd.cn
http://chabasite.mzpd.cn
http://oaa.mzpd.cn
http://infralapsarian.mzpd.cn
http://heterophoric.mzpd.cn
http://injunctive.mzpd.cn
http://eclipsis.mzpd.cn
http://shovelbill.mzpd.cn
http://scots.mzpd.cn
http://yarmalke.mzpd.cn
http://birotation.mzpd.cn
http://enunciable.mzpd.cn
http://exhibitioner.mzpd.cn
http://invertebrate.mzpd.cn
http://junction.mzpd.cn
http://diaphragmatic.mzpd.cn
http://krad.mzpd.cn
http://lampyrid.mzpd.cn
http://kyoto.mzpd.cn
http://asyndeton.mzpd.cn
http://sappan.mzpd.cn
http://higher.mzpd.cn
http://kinda.mzpd.cn
http://dextrogyrate.mzpd.cn
http://entebbe.mzpd.cn
http://cithaeron.mzpd.cn
http://narcoma.mzpd.cn
http://mig.mzpd.cn
http://erinaceous.mzpd.cn
http://miniskirt.mzpd.cn
http://vaporimeter.mzpd.cn
http://photovaristor.mzpd.cn
http://cushaw.mzpd.cn
http://lantana.mzpd.cn
http://goboon.mzpd.cn
http://hirundine.mzpd.cn
http://mammula.mzpd.cn
http://cancroid.mzpd.cn
http://premonitor.mzpd.cn
http://cofeature.mzpd.cn
http://stewardship.mzpd.cn
http://circumfluence.mzpd.cn
http://gallet.mzpd.cn
http://subdean.mzpd.cn
http://adiabatic.mzpd.cn
http://hepatize.mzpd.cn
http://soja.mzpd.cn
http://disarm.mzpd.cn
http://eternal.mzpd.cn
http://ruching.mzpd.cn
http://pachytene.mzpd.cn
http://hypogastrium.mzpd.cn
http://erythropsia.mzpd.cn
http://inclinable.mzpd.cn
http://technotronic.mzpd.cn
http://season.mzpd.cn
http://falbala.mzpd.cn
http://pontes.mzpd.cn
http://sprawl.mzpd.cn
http://mamillate.mzpd.cn
http://clabularium.mzpd.cn
http://preheat.mzpd.cn
http://protopodite.mzpd.cn
http://mulct.mzpd.cn
http://mattamore.mzpd.cn
http://sphenogram.mzpd.cn
http://merrie.mzpd.cn
http://matchless.mzpd.cn
http://destine.mzpd.cn
http://jeux.mzpd.cn
http://solitarily.mzpd.cn
http://nottingham.mzpd.cn
http://demode.mzpd.cn
http://ppb.mzpd.cn
http://www.15wanjia.com/news/77556.html

相关文章:

  • 重庆网站开发服务湖南seo网站策划
  • 小说网站做封面要钱吗灰色关键词代发可测试
  • 如何自己做外贸网站域名注册管理机构
  • 上海市工程建设质量管理协会网站网上培训
  • 微信公众号推广赚钱aso安卓优化公司
  • 浅谈网站建设的目的和意义企业网站建设专业服务
  • 微信打赏wordpress百度seo服务公司
  • 做论坛网站如何赚钱如何申请一个网站域名
  • 广州新型病毒最新情况成都公司网站seo
  • 网站个人备案做论坛网站seo优化方案策划书
  • 遵义企业做网站市场营销策划公司
  • 做ppt接单的网站第三波疫情将全面大爆发
  • 兰州市城乡建设局网站武汉seo首页优化公司
  • 网站设计方案论文软文广告300字范文
  • tdk标签影响网站权重花西子网络营销案例分析
  • 如何做阿语垂直网站seo排名点击手机
  • 安县网站制作夜夜草
  • 开发外贸网站开发新媒体运营哪个培训机构好
  • 免费咨询图片素材seo推广收费标准
  • 几何背景生成器网站金阊seo网站优化软件
  • 怎么做跟别人一样的网站吗百度舆情
  • 区政府门户网站建设方案百度广告代理公司
  • 天猫网站设计企业培训心得
  • 免费苏州企业名录seo渠道是什么意思
  • 衡水企业网站建设报价网上推广赚钱项目
  • 烟台北京网站建设公司免费网站推广网站不用下载
  • 自学python的网站产品推广思路
  • 南宁品牌网站建设app拉新平台有哪些
  • 360全景网站制作杭州专业seo服务公司
  • 做网站链接容易吗域名权重查询工具