国内有什么网站浙江十大外贸公司

news/2025/10/4 13:54:42/文章来源:
国内有什么网站,浙江十大外贸公司,网站设计流程及制作流程,学做网站 软件线性表存储结构分为顺序存储、链式存储。 顺序存储的优点#xff1a; 顺序存储的缺点#xff1a; 链表就是典型的链式存储#xff0c;将线性表L #xff08;a0,a1,a2,........an-1#xff09;中个元素分布在存储器的不同存储块#xff0c;成为结点#xff08;Node… 线性表存储结构分为顺序存储、链式存储。 顺序存储的优点 顺序存储的缺点 链表就是典型的链式存储将线性表L a0,a1,a2,........an-1中个元素分布在存储器的不同存储块成为结点Node通过地址或指针建立他们之间的练习所得到的存储结构为链表结构。表中元素ai的结点形式如下 其中结点的data域存放数据元素ai,而next域是一个指针指向ai的直接后继a(i1)所在的结点。于是线性表La0,a1,......an-1的结构如图 一、节点类型描述 [cpp] view plaincopy typedef struct node_t   {       data_t data; //节点的数据域       struct node_t *next;//节点的后继指针域   }linknode_t,*linklist_t;   也可这样表示 [cpp] view plaincopy struct node_t   {       data_t data;        struct node_t *next;   }   typedef struct node_t linknode_t;   typedef struct node_t *linklist_t;   若说明 linknode_t  A; linklist_t p  A; 则结构变量A为所描述的节点而指针变量P为指向此类型节点的指针p的值为节点的地址 这样看来 linknode_t  linklist_t 的作用是一样的那为什么我们要定义两个数据类型同一种呢主要为了代码的可读性我们要求标识符要望文识义便于理解 1、linknode_t  *pnode  指向一个节点 2、linklist_t list  指向一个整体 二、头结点 head 我们在前篇提到的顺序存储线性表如何表达一个空表{ }是通过list-last -1来表现的所谓的空表就是数据域为NULL而我们的链表有数据域和指针域我们如何表现空链表呢这时就引入了头结点的概念头结点和其他节点数据类型一样只是数据域为NULLhead-next NULL下面我们看一个创建空链表的函数如何利用头结点来创建一个空链表 [cpp] view plaincopy linklist_t CreateEmptyLinklist()   {       linklist_t list;          list  (linklist_t)malloc(sizeof(linknode_t));       if (NULL ! list) {           list-next  NULL;       }       return list;   }   只要头结点链表就还在 三、链表基本运算的相关算法 链表的运算除了上面的创建空链表还有数据的插入删除查找等函数链表的运算有各种实现方法如何写出一个高效的封装性较好的函数是我们要考虑的比如数据插入函数我们就要尽可能考虑所有能出现的结果比如1如果需插入数据的链表是个空表2所插入的位置超过了链表的长度如果我们的函数能包含所有能出现的情况不仅能大大提高我们的开发效率也会减少代码的错误率。下面我们来看看下面的这个链表的插入函数的实现 [cpp] view plaincopy int InsertLinklist(linklist_t list, int at, data_t x)   {       linknode_t *node_prev, *node_at, *node_new;       int pos_at;       int found  0;          if (NULL  list) return -1;          /* at must  0  */       if (at  0) return -1;              /*第一步、分配空间*/       node_new  malloc(sizeof(linknode_t));       if (NULL  node_new)        {           return -1;       }       node_new-data  x; /* assigned value */       node_new-next  NULL; /*节点如果插入超过链表长度的位置会接到尾节点后面这样node_new成了尾节点node_new-next  NULL */          /*第二步、定位*/       node_prev  list;//跟随指针帮助我们更好的定位       node_at  list-next; //遍历指针       pos_at  0;       while (NULL ! node_at)        {           if (pos_at  at)           {               found  1; //找到正确的位置跳出循环               break;                     }              /* move to the next pos_at */           node_prev  node_at; //跟随指针先跳到遍历指针的位置           node_at  node_at-next;//遍历指针跳到下一个节点的位置           pos_at;       }          /*第三步、插入*/         if (found)        {           /* found  1,找到正确的位置插入  */           node_new-next  node_at;//插入的节点next指向node_at           node_prev-next  node_new;//插入节点的前一个节点       }        else        {           /*若是没找到正确的位置即所插入位置超越了链表的长度则接到尾节点的后面同样这样适用于{ }即空链表这样我们可以建立一个空链表利用这个函数实现链表的初始化*/           node_prev-next  node_new;       }          这个插入函数可利用性就非常高。 下面讲一个完整链表代码贴出 listlink.h [cpp] view plaincopy #ifndef _LNK_LIST_H_   #define _LNK_LIST_H_      typedef int data_t;      typedef struct node_t {       data_t data;       struct node_t *next;   } linknode_t, *linklist_t;      linklist_t CreateEmptyLinklist();      void DestroyLinklist(linklist_t list);      void ClearLinklist(linklist_t list);      int EmptyLinklist(linklist_t list);      int LengthLinklist(linklist_t list);      int GetLinklist(linklist_t list, int at, data_t *x);      int SetLinklist(linklist_t list, int at, data_t x);      int InsertLinklist(linklist_t list, int at, data_t x);      int DeleteLinklist(linklist_t list, int at);      linklist_t ReverseLinklist(linklist_t list);      #endif /* _LNK_LIST_H_ */   linklist.c [cpp] view plaincopy #include stdio.h   #include stdlib.h   #include linklist.h      linklist_t CreateEmptyLinklist()   {       linklist_t list;       list  (linklist_t)malloc(sizeof(linknode_t));          if (NULL ! list) {           list-next  NULL;       }          return list;   }      void DestroyLinklist(linklist_t list)   {       if (NULL ! list) {           ClearLinklist(list);           free(list);       }   }      void ClearLinklist(linklist_t list)   {       linknode_t *node; /* pointer to the node to be removed */       if (NULL  list) return;          while (NULL ! list-next) {           node  list-next;           list-next  node-next;           free(node);       }       return;   }      int LengthLinklist(linklist_t list)   {       int len  0;       linknode_t *node; //iterate pointer          if (NULL  list) return -1;          node  list-next; // node points to the first data node       while (NULL ! node) {           len;           node  node-next;       }       return len;   }      int EmptyLinklist(linklist_t list)   {       if (NULL ! list) {           if (NULL  list-next) {               return 1;           } else {               return 0;           }       } else {           return -1;       }   }      int GetLinklist(linklist_t list, int at, data_t *x)   {       linknode_t *node;   /* used for iteration */       int pos;        /* used for iteration and compare with */          if (NULL  list) return -1;       /* at must  0 */       if (at  0) return -1;       /* start from the first element */       node  list-next;       pos  0;       while (NULL ! node) {           if (at  pos) {               if (NULL ! x) {                   *x  node-data;               }               return 0;                      }           /* move to the next */           node  node-next;           pos;       }       return -1;   }            int SetLinklist(linklist_t list, int at, data_t x)   {       linknode_t *node; /* used for iteration */       int pos;       int found  0;          if (!list) return -1;       /* at must  0 */       if (at  0) return -1;       /* start from the first element */       node  list-next;       pos  0;       while (NULL ! node) {           if (at  pos) {                found  1; /* found the position */               node-data  x;               break;                     }           /* move to the next */           node  node-next;           pos;       }       if (1  found) {           return 0;       } else {           return -1;       }   }      int InsertLinklist(linklist_t list, int at, data_t x)   {       /*        * node_at and pos_at are used to locate the position of node_at.       * node_prev follows the node_at and always points to previous node        *  of node_at.       * node_new is used to point to the new node to be inserted.       */       linknode_t  *node_prev, *node_at, *node_new;       int     pos_at;       int         found  0;          if (NULL  list) return -1;          /* at must  0 */       if (at  0) return -1;          node_new  malloc(sizeof(linknode_t));       if (NULL  node_new) {           return -1;       }       node_new-data  x; /* assigned value */       node_new-next  NULL;          node_prev  list;       node_at  list-next;       pos_at  0;       while (NULL ! node_at) {           if (pos_at  at) {               /*                * found the node at               */                found  1;               break;                     }           /* move to the next pos_at */           node_prev  node_at;           node_at  node_at-next;           pos_at;       }              if (found) {           /* insert */           node_new-next  node_at;           node_prev-next  node_new;       } else {           /*            * If not found, means the provided at           * exceeds the upper limit of the list, just            * append the new node to the end of the list.           */           node_prev-next  node_new;       }       return 0;   }      int DeleteLinklist(linklist_t list, int at)   {       /*        * node_at and pos_at are used to locate the position of node_at.       * node_prev follows the node_at and always points to previous node        *  of node_at.       */          linknode_t  *node_prev, *node_at;       int     pos_at;       int         found  0;          if (!list) return -1;       /* at must  0 */       if (at  0) return -1;          node_prev  list;       node_at  list-next;       pos_at  0;           while (NULL ! node_at) {           if (pos_at  at) {               /*                * found the node at               */                found  1;               break;                     }           /* move to the next pos_at */           node_prev  node_at;           node_at  node_at-next;           pos_at;       }       if (found) {           /* remove */           node_prev-next  node_at-next;           free(node_at);           return  0;       } else {           return -1;       }   }      linklist_t ReverseLinklist(linklist_t list)   {       linknode_t *node;   /* iterator */       linknode_t *node_prev;  /* previous node of iterator */       linknode_t *node_next;  /* next node of iterator,                    * used to backup next of iterator                    */       if (NULL  list) return NULL;       node_prev  NULL;       node  list-next;       while (NULL ! node) {           /*           * step1: backup node-next           * due to the next of iterator will be           * modified in step2           */           node_next  node-next;           /*            * when iterator reaches the last node            * of original list, make the list head           * point to the last node, so the original           * last one becomes the first one.           */              if (NULL  node_next) {               list-next  node;           }              /*            * step2: reverse the linkage between nodes           * make the node pointer to the previous node,           * not the next node           */                node-next  node_prev;                 /*            * step3: move forward            */              node_prev  node;           node  node_next;       }       return list;   }   main.c [cpp] view plaincopy #include stdio.h   #include stdlib.h   #include linklist.h      int main()   {       int i;       data_t x;       linklist_t p;       p  CreateEmptyLinklist();       data_t a[10]  {1,3,5,7,9,11,13,15,17,19};          for(i  0;i  10;i)       {           InsertLinklist(p,i,a[i]);       }          ReverseLinklist(p);       printf(The length of the list is:%d\n,LengthLinklist(p));              GetLinklist(p,4,x);       printf(The NO.4 of this list is:%d\n,x);          SetLinklist(p,4,100);       GetLinklist(p,4,x);       printf(After updating!The No.4 0f this list is:%d\n,x);          DeleteLinklist(p,4);       printf(After updating!The length of the list is:%d\n,LengthLinklist(p));       GetLinklist(p,4,x);       printf(After updating!The No.4 0f this list is:%d\n,x);          ReverseLinklist(p);              ClearLinklist(p);       if(EmptyLinklist(p))           printf(This list is empty!\n);       DestroyLinklist(p);       printf(This list is destroyed!\n);          return 0;          }   执行结果如下 [cpp] view plaincopy fsubuntu:~/qiang/list/list2$ ./Test   The length of the list is:10   The NO.4 of this list is:11   After updating!The No.4 0f this list is:100   After updating!The length of the list is:9   After updating!The No.4 0f this list is:9   This list is empty!   This list is destroyed!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/927196.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

做导购网站赚钱吗WordPress相册插件pro

项目展示 三栏布局是一种常用的网页布局结构。 除了头部区域、底部区域外,中间的区域(主体区域)划分成了三个栏目,分别是左侧边栏、内容区域和右侧边栏,这三个栏目就构成了三栏布局。当浏览器的宽度发声变化时&#x…

新手学做网站内容网站备案周期

摘要 https://arxiv.org/pdf/2312.07526.pdf 实时多人姿态估计在平衡速度和精度方面提出了重大挑战。虽然两阶段自上而下的方法随着图像中人数增加而变慢,但现有的单阶段方法往往无法同时提供高精度和实时性能。本文介绍了RTMO,这是一种单阶段姿态估计框…

3小时入门Python无人机编程课程 包含4个项目:监控无人机,人脸跟踪飞行和无人机寻线等(2021最新教程)

3小时入门Python无人机编程课程 包含4个项目:监控无人机,人脸跟踪飞行和无人机寻线等(2021最新教程)资料: https://www.youtube.com/watch?v=LmEcyQnfpDA https://www.bilibili.com/video/BV12X4y1T7WD/https://w…

网站开发用到的虚拟机有哪些商城展示网站建设

轻量可靠的小程序UI组件库,主流移动组件库 Vant 的微信小程序版本。Vant Weapp 和 Vant 的区别之前推荐过的移动端web组件库 Vant 是 Vue.js 版本的,其对内承载了有赞所有核心业务,对外有十多万开发者在使用,一直是业界主流的移动…

CopilotKit

CopilotKit https://docs.copilotkit.ai/ https://github.com/copilotkit/copilotkitWhat is CopilotKit?CopilotKit is the easiest way to add AI copilots - intelligent, context-aware assistants - into your a…

站群系统源码怎么看一个网站是什么时候做的

背景: 项目升级,引入MySQL数据库,之前一直用的是Oracle数据,在做用户登录单位维护的时候,需要返回该用户所属单位下的所有子单位。下边是模拟项目数据实践的过程。 数据准备: 准备一张单位表&#xff0c…

ag-ui

ag-ui https://github.com/ag-ui-protocol/ag-ui?tab=readme-ov-file AG-UI: The Agent-User Interaction Protocol AG-UI is an open, lightweight, event-based protocol that standardizes how AI agents connect …

SCCPC2021重现赛

I Rock Paper Scissors 考场上先看到了 T ≤ 1e3 然后开始质疑贪心算法的正确性。两位队友打完后都WA了,我也没想出来哪有问题,重现赛就放过了这道题。等到下午调题的时候自己打了个贪心交上去,发现 WA on #4 ,输出…

Ros2_control浅析——一个机器人开发通用框架的结构(1)

初学者结合个人理解来讨论一下Ros2_control框架,有错误烦请大佬批评指正。引言: 最近在开发一个送餐机器人,但是在电机和ros2系统交互时犯了难,不知道该怎么写才能让系统架构清晰一些,后来了解到ros2社区有一个规范的…

图的计数问题没做

确实没做。确实没做。

如何设计量子密钥管理系统?——面向后量子时代的密钥管理架构与核心特性探讨

如何设计量子密钥管理系统?——面向后量子时代的密钥管理架构与核心特性探讨2025-10-04 13:41 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-…

沈阳世纪兴网站建设WordPress首页做成插件

文章目录 1.Git简介2.安装Git2.1在Centos上安装git2.2 在ubuntu上安装git 3.创建本地仓库4.配置本地仓库 1.Git简介 Git是一个分布式版本控制系统,用于跟踪和管理文件的更改。它可以记录和存储代码的所有历史版本,并可以方便地进行分支管理、合并代码和协…

11_linux镜像下载

Linux 镜像文件ISO下载地址指南 概述 本文档整理了常用Linux发行版的官方镜像下载地址,方便开发者和系统管理员快速获取所需的Linux系统镜像。 主要Linux发行版下载地址 1. CentOS 官方下载地址:CentOS 7: http://is…

CF2152 Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) 游记

$59min$ 开出 $4t$,压线绝杀 E 拿到表现分 $2117$。省流 \(59min\) 开出 \(4t\),压线绝杀 E 拿到表现分 \(2117\)。10.3 内含剧透,请vp后再来。 不是题解!!!!!!! 赛前 国庆之后几天的效率极其低下,只补了三…

完整教程:MindsDB在金融领域的应用:智能风险评估系统

完整教程:MindsDB在金融领域的应用:智能风险评估系统2025-10-04 13:28 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; d…

使用 chrome 调试 android webview 前端 dom script

使用 chrome 调试 android webview 前端 dom script手机连接 USB 调试 chrome 中输入 chrome://inspect 选择对应的设备调试即可桂棹兮兰桨,击空明兮溯流光。

禅城网站建设企业石家庄建站模板源码

有时候我们的目录结构会重新刷新,但是default-active始终保持原来的下标 1.一开始我以为是我给定的属性或者值不对,后来经过一番排查发现根本不是 那我们该如何解决那? 方案1. 通过nextTick去重新赋值方案2. 重写赋值menu方案3. v2和v3都可以…

公司网站开发费怎么入账公司企业邮箱申请流程

文章目录路径总和 I路径总和 II比较简单,就连着一起写了 路径总和 I 注意:一定得走到叶子才算 直接看代码吧,注释也就几行。 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* T…

php学完可以做网站仁怀哪里可以做网站

是的,2023年的java行业如网上说的。 “行业寒冬!!” 后台有粉丝私信我,跟他同期进公司的同事,现在只剩下他自己了,并且每天有很多人来公司面试,很担心自己哪天就被炒了。 程序员就是这样&…

html做成网页aso优化方案

文章目录 1. 定义2. 应用场景3. 代码实现结语 解释器模式(Interpreter Pattern)是一种行为型设计模式,用于定义语言的文法规则,并提供解释器来解释符合规则的语句。解释器模式通过定义语言的文法表示,使得可以解释执行…