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

dremwear做网站网店营销策划方案范文

dremwear做网站,网店营销策划方案范文,网站案例模板,建设银行官方网站 诚聘英才方法一#xff1a;暴力求解 1️⃣遍历原链表#xff0c;复制节点尾插 2️⃣更新random#xff0c;原链表中的random对应第几个节点则复制链表中的random就对应第几个 #x1f4d6;Note 不能通过节点中的val判断random的指向#xff0c;因为链表中可能存在两个val相等的节点… 方法一暴力求解 1️⃣遍历原链表复制节点尾插 2️⃣更新random原链表中的random对应第几个节点则复制链表中的random就对应第几个 Note 不能通过节点中的val判断random的指向因为链表中可能存在两个val相等的节点 //创建节点 struct Node* BuyNode(int x) {struct Node* newnode (struct Node*)malloc(sizeof(struct Node));newnode-val x;newnode-next NULL;return newnode; }//找到random对应的节点是第几个 int FindRandom(struct Node* head, struct Node* random) {int count 1;while (head){if (head random){return count;}else {count;head head-next;}}return count; }struct Node* copyRandomList(struct Node* head) {struct Node* guard (struct Node*)malloc(sizeof(struct Node));guard-next NULL;struct Node* tail guard;struct Node* cur head;//复制原链表while (cur){struct Node* newnode BuyNode(cur-val);tail-next newnode;tail tail-next;cur cur-next;}//tail和cur都指向新链表的头tail guard-next;struct Node* tmp head;//更新randomwhile (tail){//在原链表这种判断random指向的节点是第几个int count FindRandom(head, tmp-random);tmp tmp-next;//更新复制链表中的randomcur guard-next;while (count--){tail-random cur;if (cur){cur cur-next;}}tail tail-next;}struct Node* newhead guard-next;free(guard);return newhead;} 方法二 1️⃣拷贝原节点并链接在原节点之后 2️⃣更新拷贝节点中的random 拷贝节点中的random指向的是原节点中random指向节点的下一个节点 3️⃣将拷贝的节点解下来构成新的复制链表 struct Node* copyRandomList(struct Node* head) {struct Node* cur head;struct Node* copy NULL;//拷贝原节点并链接在原节点之后while (cur){copy (struct Node*)malloc(sizeof(struct Node));copy-val cur-val;copy-next cur-next;cur-next copy;cur cur-next-next;}//更新拷贝节点的randomcur head;while (cur){copy cur-next;if (cur-random){copy-random cur-random-next;}else{copy-random NULL;}cur cur-next-next;}//将所有拷贝节点解下来构成新链表并恢复原链表结构cur head;struct Node* copyhead, *copytail;copyhead copytail NULL;while (cur){copy cur-next;//取节点尾插if (copytail NULL){copyhead copytail copy;}else{copytail-next copy;copytail copytail-next;}//恢复原链表cur-next copy-next;cur copy-next;}return copyhead; }
http://www.hkea.cn/news/14440404/

相关文章:

  • 网站设计的要求有哪些网站标题flash
  • 学做网站能赚钱吗做网站虚拟主机
  • 青岛做网站青岛做网站网站建设和网络推广方案
  • 商洛市住房和城乡建设局网站苏州高级网站建设
  • 手机网站建设优化软件免费学习做网站
  • 共享经济网站建设策划书关闭wordpress多站点
  • 中国网站建设第一品牌沈阳专门代做网站的
  • 遵义网站建设哪家好建立网站的基本步骤
  • 做asp网站教程网站的互动功能
  • wordpress工业产品企业网站主题网站被k申述
  • 网站内容建设项目预算福州网站维护公司
  • 设计 网站访问次数企业咨询公司收费标准
  • 南昌企业网站建设软件技术有限公司
  • 做网站细节安陆网站建设推广
  • 北京网站制作公司建站网站建站平台源码
  • 网站建设注意门户网站wordpress哪个比较好
  • 无锡网站建设无锡速联科技百度推广代理公司
  • 可以投稿的写作网站如何创建免费网站
  • 中核华兴建设有限公司投标网站企业培训体系
  • 建设装饰网站用php做的博客网站有哪些
  • 佛山网站开发html5 珠宝网站
  • 中企做一个网站多少钱平面设计外包公司
  • 东莞网站营销包头焦点网站建设
  • 虚拟主机 两个网站部门网站建设意见
  • 织梦响应式网站模板wordpress 禁止保存
  • 网站推广文章行业关键词一览表
  • 福田沙头网站建设wordpress 客户端管理员密码
  • asp 网站模板淘宝网电脑版
  • 给企业做网站怎么收钱怎么建设商城网站
  • 水泵行业网站怎么做cgi做网站