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

帮别人做违法网站会判刑吗网站开发后台技术

帮别人做违法网站会判刑吗,网站开发后台技术,做关于卖宠物饲料网站有什么名字吗,在线建站模板题目一: 题目链接: 思路一: 找相对位置暴力求解的方法: 1.复制一个新的链表出来遍历老的节点给新的节点赋值,random这个时候不去值。 2.两个链表同时遍历,遍历老链表的时候去寻找相对位置,在遍…

题目一:

请添加图片描述
题目链接:

思路一:

找相对位置暴力求解的方法:
1.复制一个新的链表出来遍历老的节点给新的节点赋值,random这个时候不去值。
2.两个链表同时遍历,遍历老链表的时候去寻找相对位置,在遍历新的链表找到随机值赋值。

struct Node* copyRandomList(struct Node* head) {struct Node* cur=head;struct Node* newhead=NULL,*tile=NULL;//复制原来的链表数据while(cur){//开辟新的节点struct Node* newnode=(struct Node*)malloc(sizeof(struct Node));newnode->val=cur->val;newnode->next=NULL;newnode->random=NULL;if(newhead==NULL){tile=newhead=newnode;}else{tile->next=newnode;tile=tile->next;}cur=cur->next;}//进行两个的循环遍历,找相对位置cur=head;struct Node* cur2=newhead;int pos=0;while(cur){//更新一下pospos=0;//cur的随机值是哪一个struct Node* find=cur->random;if(find==NULL){cur2->random=NULL;cur=cur->next;cur2=cur2->next;continue;}else{struct Node* curold=head;while(curold){if(find==curold){break;}pos++;curold=curold->next;}}//寻找随机节点struct Node* curnew=newhead;while(pos){curnew=curnew->next;pos--;}cur2->random=curnew;//循环条件cur=cur->next;cur2=cur2->next;}return newhead;
}

思路二:

请添加图片描述

struct Node* copyRandomList(struct Node* head) {struct Node* cur = head, * tile = NULL;//新的链表赋值插入,cur为空才结束插入while (cur){//保存下一个老的tile = cur->next;struct Node* newnode = (struct Node*)malloc(sizeof(struct Node));newnode->val = cur->val;cur->next = newnode;newnode->next = tile;//循环条件cur = tile;}//给copy链表赋值randomstruct Node* copy = NULL;cur = head;tile = NULL;while (cur){//连接了新的节点copy = cur->next;tile = copy->next;//给random赋值,随机值,正常值的两个情况if (cur->random == NULL){copy->random = NULL;}else{copy->random = cur->random->next;}//循环的移动cur = tile;}copy = NULL;cur = head;tile = NULL;//分离链表struct Node* newhead = NULL;struct Node* move = NULL;while (cur){copy = cur->next;tile = copy->next;if (newhead == NULL){newhead = copy;move = newhead;}else{move->next = copy;move = move->next;}//恢复原来的节点cur->next = tile;//循环遍历cur = tile;}return newhead;}
http://www.yayakq.cn/news/795525/

相关文章:

  • 自己做物流网站wordpress带轮播企业站主题
  • 网站设计的用途如何做网站预览
  • 网站内页标题桓台网站
  • 百度网站收录查询地址手上有一个好网站怎么做赚钱
  • 网站开发微盘百度公众号
  • 网站域名不合法网络营销推广培训班
  • 专做网站公司奥利奥广告策划书
  • 让人做网站 需要准备什么软件用redis加速wordpress
  • 网站建设用的是什么软件网站开发方案 文档
  • 温州网站关键词怎样做网站手机客户端
  • 佛山微网站建设报价wordpress post 与 page 区别
  • 宝尊电商是做什么的温州seo优化
  • 昆明网站公司建设甘肃省专业做网站
  • 如何建设下载网站ps如何做ppt模板下载网站
  • wordpress个人网站赚钱体育网站开发的目的
  • 网站建设论文标题百度首页排名优化哪家专业
  • 网站关键字优化价格用ps制作黑色高光网站按钮
  • 网站虚拟机可以自己做吗广州购物网站设计
  • 营业执照注册网站网站外包注意事项
  • 网站开发项目任务接软件开发项目的平台
  • 网站实施就是网站建设微信电子宣传册制作app
  • 用dw做网站的视频做网站niche
  • 新农村建设专题网站建设电影网站点击播放是乱页的
  • 网站工程工资一般多少钱百度爱采购推广平台
  • 广州网站建设服务哪家好淡蓝色网站
  • 可以搜索国外网站的搜索引擎网站怎么做才能赚钱
  • 自己建设的网站有管理后台的登录wordpress手机版难看
  • 怎么给自己网站做搜索框网络推广平台几大类
  • 网站设计与制作教程1微信服务号功能开发
  • 网页和站点的区别山西住房和城乡建设厅网站