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

网站上做公司宣传三只松鼠网络营销策略

网站上做公司宣传,三只松鼠网络营销策略,外贸网站建设信息,网站备案本人承诺储备知识: 线性表 :一对一的数据所组成的关系称为线性表。 线性表是一种数据内部的逻辑关系,与存储形式无关线性表既可以采用连续的顺序存储(数组),也可以采用离散的链式存储(链表)顺序表和链表都称为线性表 顺序存储就是将数据存…

储备知识:

线性表 :一对一的数据所组成的关系称为线性表。

  • 线性表是一种数据内部的逻辑关系,与存储形式无关
  • 线性表既可以采用连续的顺序存储(数组),也可以采用离散的链式存储(链表)
  • 顺序表和链表都称为线性表

顺序存储就是将数据存储到一片连续的内存中,在C语言环境下,可以是具名的栈数组,或者是匿名的堆数组。

栈空间:char buf[4];自动申请空间,函数结束后自动释放,{}内定义的局部变量,{}过后自动释放,空间大小为8M

堆空间:malloc(16) calloc(4,sizeof(int)) realloc()

手动分配空间,手动释放空间,空间大小为实际物理内存,空间生命周期为整个程序的生命周期

1.优点

  • 不需要多余的信息来记录数据的关系,存储密度高
  • 所有数据顺序存储在一片连续的内存中,支持立即访问任意一个随机数据

2.缺点

  • 插入、删除时需要保持数据的物理位置反映其逻辑关系,需要成片移动数据
  • 当数据节点较多时,需要一整片较大的连续内存空间
  • 当数据节点数量变化剧烈时,内存的释放和分配不灵活

链表存储可以将数据存储到不连续的内存空间中,可以是单链表或双链表。

单链表

一种常见的数据结构,它由一系列节点组成,每个节点包含了数据部分和指向下一个节点的指针。在单链表中,第一个节点称为头节点,最后一个节点的指针指向空,表示链表的结束。

特点

  • 动态大小:单链表的大小可以根据需要动态增长或缩小。
  • 插入和删除操作:在单链表中插入或删除节点通常比较灵活,只需要改变相邻节点的指针即可。
  • 不需要连续内存:与数组不同,单链表的节点不需要在内存中连续存储,它们可以分散在内存的任何位置。
  • 访问效率:访问单链表中的元素需要从头节点开始,逐个遍历到所需位置,因此访问效率相对较低。

单链表的常见操作包括:

  • 插入:在链表的指定位置插入新节点。
  • 删除:删除链表中的指定节点。
  • 搜索:查找链表中包含特定数据的节点。
  • 遍历:从头节点开始,依次访问链表中的每个节点。

创建有头结点单链表

1. 从无到有:第一个节点的诞生,此时的首节点和尾节点都是它本身

2 .从少到多(添加节点过程):

  • 尾插法

新节点插入在选定节点后面所选节点为尾节点(last)原指向的节点,则原来的尾节点被新节点替代,成为新的尾节点。

  • 头插法

新节点插入在选定节点前面所选节点为首节点(last)原指向的节点,则原来的首节点被新节点替代,成为新的首节点。

// 定义数据节点
struct node
{dataType data; // 数据域struct node *next; // 指针域,存放(指向)下一个节点的地址
};// 定义头节点
struct headNode
{struct node *first; // 指向第一个数据节点struct node *last; // 指向最后一个数据节点int nodeNumber; // 记录链表节点数
};//创建头节点
struct headNode* create_new_headNode()
{struct headNode* head =  malloc(sizeof(struct headNode));if(head == NULL)return NULL;head->first = NULL;head->last = NULL;head->nodeNumber = 0;return head;
}// 创建新节点
struct node* create_new_node(dataType data)
{struct node* pnew =  malloc(sizeof(struct node));if(pnew == NULL)return NULL;pnew->data = data;pnew->next = NULL;return pnew;
}// 尾插法
void addTail(struct headNode *head,struct node* pnew)
{head->last->next = pnew;head->last = pnew;
}//创建链表
struct headNode* create_list()
{// 创建头节点struct headNode* head = create_new_headNode();if(head == NULL)return NULL;dataType data = -1;while(1){scanf("%d",&data);if(data == 0)break;// 创建新节点struct node* pnew = create_new_node(data);if(pnew == NULL)return NULL;// 从无到有if(head->first == NULL){head->first = pnew;head->last = pnew;}else // 从少到多{// 尾插法addTail(head,pnew);}// 更新节点head->nodeNumber++;}return head;
}//显示链表
void showList(struct headNode* head)
{if(head->first == NULL){printf("链表为空\n");return;}for(struct node* p = head->first;p != head->last->next;p = p->next){printf("%d\t",p->data);}printf("\n");printf("链表节点数为:%d\n",head->nodeNumber);
}

双链表

是一种链式数据结构,它由一系列节点组成,每个节点除了包含数据外,还包含两个指针:一个指向前一个节点,一个指向后一个节点。这种结构允许双向遍历链表,即可以从头节点开始向前遍历,也可以从尾节点开始向后遍历。

特点:

  1. 双向链接:每个节点都有指向前一个和后一个节点的指针,这使得在链表中的移动更加灵活。
  2. 动态大小:与单链表一样,双链表的大小可以动态变化。
  3. 插入和删除操作:在双链表中,插入和删除操作通常比单链表更加高效,因为可以直接访问前一个或后一个节点,而不需要像单链表那样从头节点开始遍历。
  4. 不需要连续内存:节点在内存中不需要连续存储,可以分散在内存的任何位置。

双链表的常见操作包括:

  • 插入:可以在链表的任意位置插入新节点,包括在头节点之前或尾节点之后。
  • 删除:可以快速删除指定节点,因为可以直接访问前一个和后一个节点来更新指针。
  • 搜索:可以从头或尾开始搜索特定数据的节点。
  • 遍历:可以正向或反向遍历链表。

创建有头结点双链表

// 创建数据节点
struct node
{dataType data;struct node *prev;// 指向上一个节点struct node *next;// 指向下一个节点
};// 创建头节点
struct headNode
{struct node *first; // 指向首节点struct node *last; // 指向最后一个节点int nodeNumber; // 记录节点数
};// 创建头节点
struct headNode *create_head()
{// 创建头节点struct headNode *head = malloc(sizeof(struct headNode));if(head == NULL){perror("create head failed:");return NULL;}head->first = NULL;head->last = NULL;head->nodeNumber = 0;return head;
}// 创建新节点
struct node *create_new_node(dataType data)
{struct node *pnew = malloc(sizeof(struct node));if(pnew == NULL){perror("create new node failed:");return NULL;}pnew->data = data;pnew->prev = NULL;pnew->next = NULL;
}//增加节点
struct headNode *add_node_list(struct headNode *head,dataType newData,dataType data)
{// 创建新节点struct node *pnew = create_new_node(newData);if(pnew == NULL)return NULL;// 找节点struct node *p = head->first;while(p){if(p->data == data)break;else{p = p->next;}}// 如果找的是第一个节点if(p->data == head->first->data){addHead(pnew,head);}else if(p == NULL){addTail(pnew,head);}else{pnew->next = p;pnew->prev = p;p->prev->next = pnew;pnew->prev = pnew; }head->nodeNumber++;return head;
}//删除节点
struct headNode *del_node(struct headNode *head,dataType data)
{// 找节点struct node *p = head->first;while(p){if(p->data == data)break;elsep = p->next;}// 如果是第一个节点if(head->first->data == data){head->first->next->prev = head->first;head->first = p->next;p->next = NULL;p->prev = NULL;free(p);}else if(p->data == head->last->data){p->prev->next = NULL;p->prev = NULL;free(p);}else if(p == NULL){printf("没有可删除的节点\n");}else{p->next->prev = p->prev;p->prev->next = p->next;p->prev = NULL;p->next = NULL;free(p);}head->nodeNumber--;return head;
}//链表遍历
void showList(struct headNode *head)
{for(struct node *p = head->first;p != head->last->next;p = p->next){printf("%d\t",p->data);}printf("\n");printf("节点数为:%d\n",head->nodeNumber);
}// 销毁链表
struct headNode * distory_list(struct headNode *head)
{if(isEmpty(head))return false;// 逐一删除节点struct node *p = NULL;for(struct node *tmp = head->first;tmp != NULL; tmp = p){p = tmp->next;free(tmp);head->nodeNumber--;}return head;
}

双向循环链表

结构上和双向链表就只差首尾相连。

// 至少还有一个节点时将首尾相连
if(head->nodeNumber != 0)
{head->last->next = head->first;head->first->prev = head->last;
}


文章转载自:
http://toynbeean.Ljqd.cn
http://megohm.Ljqd.cn
http://teledata.Ljqd.cn
http://misallocation.Ljqd.cn
http://confidence.Ljqd.cn
http://crabstick.Ljqd.cn
http://novosibirsk.Ljqd.cn
http://nokia.Ljqd.cn
http://hognut.Ljqd.cn
http://winehouse.Ljqd.cn
http://indiction.Ljqd.cn
http://machicolate.Ljqd.cn
http://quinidine.Ljqd.cn
http://tenace.Ljqd.cn
http://intarsia.Ljqd.cn
http://pentalpha.Ljqd.cn
http://fracture.Ljqd.cn
http://referral.Ljqd.cn
http://limey.Ljqd.cn
http://autostoper.Ljqd.cn
http://acidoid.Ljqd.cn
http://vaporizable.Ljqd.cn
http://storehouse.Ljqd.cn
http://dun.Ljqd.cn
http://domo.Ljqd.cn
http://gastrotrichan.Ljqd.cn
http://coecilian.Ljqd.cn
http://destool.Ljqd.cn
http://kat.Ljqd.cn
http://animato.Ljqd.cn
http://supraoptic.Ljqd.cn
http://nonlicet.Ljqd.cn
http://sothiacal.Ljqd.cn
http://shlub.Ljqd.cn
http://abysmal.Ljqd.cn
http://ambitiousness.Ljqd.cn
http://drainage.Ljqd.cn
http://sheepishly.Ljqd.cn
http://francophil.Ljqd.cn
http://gerontophil.Ljqd.cn
http://skip.Ljqd.cn
http://cipango.Ljqd.cn
http://duodecagon.Ljqd.cn
http://acalycine.Ljqd.cn
http://jiggers.Ljqd.cn
http://mitigate.Ljqd.cn
http://renationalization.Ljqd.cn
http://ludwigshafen.Ljqd.cn
http://conchae.Ljqd.cn
http://aesc.Ljqd.cn
http://underlayer.Ljqd.cn
http://newyorican.Ljqd.cn
http://affirm.Ljqd.cn
http://dma.Ljqd.cn
http://spelter.Ljqd.cn
http://dolich.Ljqd.cn
http://warsle.Ljqd.cn
http://woman.Ljqd.cn
http://whore.Ljqd.cn
http://engineman.Ljqd.cn
http://airbrasive.Ljqd.cn
http://hydroponics.Ljqd.cn
http://xerasia.Ljqd.cn
http://theriacal.Ljqd.cn
http://babble.Ljqd.cn
http://karaya.Ljqd.cn
http://pilgrim.Ljqd.cn
http://archoplasm.Ljqd.cn
http://potassium.Ljqd.cn
http://haploidic.Ljqd.cn
http://tar.Ljqd.cn
http://teleran.Ljqd.cn
http://talkfest.Ljqd.cn
http://cribbing.Ljqd.cn
http://encrimson.Ljqd.cn
http://tetrastichous.Ljqd.cn
http://brazilein.Ljqd.cn
http://sextans.Ljqd.cn
http://upbuilt.Ljqd.cn
http://quadrode.Ljqd.cn
http://staff.Ljqd.cn
http://laypeople.Ljqd.cn
http://bilievable.Ljqd.cn
http://camisard.Ljqd.cn
http://aboriginal.Ljqd.cn
http://thirdly.Ljqd.cn
http://sherwani.Ljqd.cn
http://sniper.Ljqd.cn
http://curite.Ljqd.cn
http://zwitterionic.Ljqd.cn
http://pedimeter.Ljqd.cn
http://psychosomatic.Ljqd.cn
http://appetence.Ljqd.cn
http://spoilbank.Ljqd.cn
http://respirability.Ljqd.cn
http://laconic.Ljqd.cn
http://reliable.Ljqd.cn
http://prolamin.Ljqd.cn
http://unambitious.Ljqd.cn
http://shredder.Ljqd.cn
http://www.15wanjia.com/news/70071.html

相关文章:

  • 免费b2b网站大全 外贸更先进的seo服务
  • 网站转移动版谷歌排名查询
  • 重庆沙坪坝做网站培训机构网站制作
  • 企业需要缴纳哪些税seo外链推广员
  • 做游戏的av迅雷下载网站如何建立一个网站平台
  • 网站建设如何排版湖南网络推广公司大全
  • 网站的推广策略大连网络推广
  • 新手想开网店怎么开持续优化完善防控措施
  • 乌克兰俄罗斯绍兴seo排名公司
  • 哪家网站做公司最好需要一个网站
  • 甘肃手机版建站系统信息湖州seo排名
  • 呼市网站优化网络营销团队
  • 建立有效的()杭州上城区抖音seo如何
  • 微商城网站建设公司seo工资待遇 seo工资多少
  • 家电维修企业网站源码网络站点推广的方法有哪些
  • 宁波找网站建设企业黄页网络的推广软件
  • 招聘58同城招人seo自学网官方
  • magento官方网站百度推广销售员的工作内容
  • 推介做界面的网站广告关键词有哪些
  • 上海住房和城乡建设厅网站上海网络推广
  • 品牌网站设计武汉关键词排名工具
  • ppt那个网站做的好百度客服人工电话24
  • 哈尔滨一个好网站建设营销推广费用预算表
  • 网站建设流程报价店铺推广渠道有哪些
  • 购车网站开发数据库er图成都网站推广经理
  • 网站建设意识形态北京seo优化
  • 宝鸡网站建设排名淘宝关键词搜索工具
  • 二手网站怎么做网站seo思路
  • 来宾网站建设郑州网站优化推广
  • 武汉网站seo技术百度2023免费