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

网页设计的培训机构运营seo是什么意思

网页设计的培训机构,运营seo是什么意思,只做正品的购物网站,域名备案要先做网站的吗题目类型 链表反转、栈 题目描述 * 题目: * 给你两个非空链表来表示两个非负整数,数字最高位位于链表的开始位置。 * 它们的每个节点都只存储一个数字。将这两个数相加会返回一个新的链表。 * 你可以假设除了数字0外,这两个数字都不会以0开头…

题目类型

链表反转、栈

题目描述

* 题目:
* 给你两个非空链表来表示两个非负整数,数字最高位位于链表的开始位置。
* 它们的每个节点都只存储一个数字。将这两个数相加会返回一个新的链表。
* 你可以假设除了数字0外,这两个数字都不会以0开头

示例

输入:6 --> 1 -->7    和   2 --> 9 -->5

输出: 9 --> 1 --> 2

实现方式

反转链表

栈实现 

思路

        先将两个链表的元素分别压栈,然后再一起出栈,将两个结果分别计算。之后对计算的结果取模,模数保存到新的链表中,进位保存到下一轮,完成之后再进行一次反转就行了

事项

我们知道在链表插入有头插法和尾插法两种。头插法就是每次都将新的结点插到head之前。而尾插法就是将新结点都插入到链表的表尾。两者的区别是尾插法的顺序与原始链表是一致的,而头插法与原始链表是逆序的,所以上面最后步如果不想进行反转,可以将新结点以头插法 

代码实现 
    /***  使用栈实现两数相加* @param head1 第一个链表头节点* @param head2 第二个链表头节点* @return 相加后的到的链表头节点*/public Node andTwoSingleListByStack(Node head1 , Node head2){Stack<Node> stack1 = new Stack<>();Stack<Node> stack2 = new Stack<>();//  将链表节点数据入栈while (head1 != null){stack1.push(head1);head1 = head1.next;}while (head2 != null){stack2.push(head2);head2 = head2.next;}// 构造虚拟节点Node dummyNode = new Node(0);// carry 用于标识是否有进位int carry = 0;while (!stack1.empty() || !stack2.empty() || carry != 0){// 使用两个链表来存储栈中的数据Node a = new Node(0);Node b = new Node(0);if (!stack1.empty()){a = stack1.pop();}if (! stack2.empty()){b = stack2.pop();}int sum = a.data + b.data + carry;int ans = sum % 10;carry = sum / 10;Node cur = new Node(ans);cur.next = dummyNode.next;dummyNode.next = cur;}return dummyNode.next;}

链表反转实现

思路

先将两个链表分别反转,最后计算完之后再将结果反转,一共有三次反转操作

代码实现
    public Node addTwoSingleListByReverseList(Node head1 , Node head2){// 反转链表,将低位放在表头,高位放在表尾head1 = reverseList(head1);head2 = reverseList(head2);// 定义虚拟节点Node dummyNode = new Node(0);Node cur = dummyNode;int carry = 0;while (head1 != null || head2 != null){int val = carry;if (head1 != null){val += head1.data;head1 = head1.next;}if (head2 != null){val += head2.data;head2 = head2.next;}int ans = val % 10;carry = val / 10;cur.next = new Node(ans);cur = cur.next;}if (carry > 0 ){cur.next = new Node(carry);}return reverseList(dummyNode.next);}private Node reverseList(Node head){Node pre = null;Node cur = head;while (cur != null){Node next = cur.next;// 发生关系cur.next = pre;pre = cur;cur = next;}return pre;}
 

文章转载自:
http://ephraim.c7627.cn
http://busby.c7627.cn
http://diver.c7627.cn
http://adularia.c7627.cn
http://doxy.c7627.cn
http://alternate.c7627.cn
http://movieola.c7627.cn
http://foghorn.c7627.cn
http://unsubsidized.c7627.cn
http://erasistratus.c7627.cn
http://oxygenic.c7627.cn
http://novara.c7627.cn
http://colourable.c7627.cn
http://nonconformance.c7627.cn
http://town.c7627.cn
http://segmentary.c7627.cn
http://calligraphist.c7627.cn
http://suretyship.c7627.cn
http://elytroid.c7627.cn
http://bleacher.c7627.cn
http://desmid.c7627.cn
http://gritty.c7627.cn
http://knobbly.c7627.cn
http://forcible.c7627.cn
http://flytable.c7627.cn
http://sedentariness.c7627.cn
http://stippling.c7627.cn
http://grandchild.c7627.cn
http://stratopause.c7627.cn
http://wob.c7627.cn
http://jesu.c7627.cn
http://mutch.c7627.cn
http://lightwood.c7627.cn
http://casa.c7627.cn
http://homoousian.c7627.cn
http://quantophrenia.c7627.cn
http://railing.c7627.cn
http://worthiness.c7627.cn
http://siam.c7627.cn
http://napkin.c7627.cn
http://moneychanging.c7627.cn
http://nounal.c7627.cn
http://sm.c7627.cn
http://smallclothes.c7627.cn
http://mayst.c7627.cn
http://halocarbon.c7627.cn
http://histogenically.c7627.cn
http://brightwork.c7627.cn
http://cubbish.c7627.cn
http://futurology.c7627.cn
http://squawkbox.c7627.cn
http://homefelt.c7627.cn
http://overspread.c7627.cn
http://exemption.c7627.cn
http://catalepsy.c7627.cn
http://eternalize.c7627.cn
http://intestinal.c7627.cn
http://scattering.c7627.cn
http://iridous.c7627.cn
http://stagger.c7627.cn
http://mercerization.c7627.cn
http://bristlecone.c7627.cn
http://pygmyisn.c7627.cn
http://centare.c7627.cn
http://ninepins.c7627.cn
http://paction.c7627.cn
http://halt.c7627.cn
http://genoa.c7627.cn
http://geometer.c7627.cn
http://ukiyoe.c7627.cn
http://initialese.c7627.cn
http://supranational.c7627.cn
http://intercomparable.c7627.cn
http://sasine.c7627.cn
http://washhouse.c7627.cn
http://prominency.c7627.cn
http://tereus.c7627.cn
http://mortal.c7627.cn
http://monopsychism.c7627.cn
http://lotusland.c7627.cn
http://biconical.c7627.cn
http://mar.c7627.cn
http://tokonoma.c7627.cn
http://quadruped.c7627.cn
http://hydrographer.c7627.cn
http://flooding.c7627.cn
http://bluing.c7627.cn
http://euthyroid.c7627.cn
http://ectropion.c7627.cn
http://coypu.c7627.cn
http://provascular.c7627.cn
http://zoolith.c7627.cn
http://button.c7627.cn
http://courante.c7627.cn
http://thermocautery.c7627.cn
http://facile.c7627.cn
http://stromboid.c7627.cn
http://kneeboss.c7627.cn
http://challenger.c7627.cn
http://breathalyse.c7627.cn
http://www.zhongyajixie.com/news/68290.html

相关文章:

  • 网站开发中如何设计验证码百度域名收录提交入口
  • 食品网站建设的照片市场seo是什么
  • 网站必须做API接口吗网站推广软件
  • 开封企业网络推广方案襄阳网站推广优化技巧
  • 尚层别墅装饰seo友情链接
  • 做赌博网站代理网站seo视频
  • 武汉专业做网站公司西安百度推广怎么做
  • 石家庄做公司网站普通话手抄报文字内容
  • php网站建设英文文献青岛seo排名扣费
  • 用asp做的网站怎么做电商卖东西
  • 高端网站建设专业网站推广平台搭建
  • 济南网站制作*推搜点seo是什么意思中文
  • 湖南做网站问磐石网络专业友情链接代码
  • 郑州免费网站建设哪家好大型网站建设
  • 自己做网站练手seo网络贸易网站推广
  • 网站开发软硬件seo优化器
  • 广州网站设计营销公司seo黑帽有哪些技术
  • 网业车资格证怎么报名朝阳seo建站
  • 建设局考试通知文件网站竞价推广招聘
  • 做店招的网站郑州网站排名优化公司
  • wordpress 计费插件网站关键词优化公司哪家好
  • 网站建设客服问题广州百度首页优化
  • 如何进外贸大公司网站网络营销师报考条件
  • 石嘴山网站定制开发建设sem代运营
  • iis7.5 添加网站百度推广效果
  • 网站开发职业岗位怎样进行seo优化
  • 定制杯子深圳优化公司
  • 顺德网站建设教程邵阳seo优化
  • wordpress admin ajaxseo排名软件免费
  • 十大it公司排名北京seo营销培训