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

什么网站是html5做的wordpress付费阅读全文

什么网站是html5做的,wordpress付费阅读全文,网站论坛推广文案怎么做,自建域名** ** 结论 让一个指针从链表起始位置开始遍历链表#xff0c;同时让一个指针从判环时相遇点的位置开始绕环运行#xff0c;两个指针都是每次均走一步#xff0c;最终肯定会在入口点的位置相遇。 LinkedList的模拟实现 单个节点的实现 尾插 运行结果如下#xff1a; 也… ** ** 结论 让一个指针从链表起始位置开始遍历链表同时让一个指针从判环时相遇点的位置开始绕环运行两个指针都是每次均走一步最终肯定会在入口点的位置相遇。 LinkedList的模拟实现 单个节点的实现 尾插 运行结果如下 也可以暴力使用 全部代码 MyLinkedList public class MyLinkedList {static class ListNode{public int val;public ListNode prev;public ListNode next;public ListNode(int val) {this.val val;}}public ListNode head;public ListNode last;//链表的长度public int size(){int len0;ListNode curhead;while(cur!null){curcur.next;len;}return len;}//打印链表public void dispaly(){ListNode curhead;while(cur!null){System.out.print(cur.val );curcur.next;}System.out.println();}//查找关键字key是否在链表中public boolean contains(int key){ListNode curhead;while(cur!null){if(cur.valkey){return true;}curcur.next;}return false;}//头插 public void addFirst(int data){ListNode nodenew ListNode(data);//空链表if(headnull){headnode;lastnode;return;}//一般情况node.nexthead;head.prevnode;headnode;}//尾插public void addLast(int data){ListNode nodenew ListNode(data);//空链表if(headnull){headnode;lastnode;return;}//一般情况last.nextnode;node.prevlast;lastnode;} //无论是头插还是尾插只要是空链表那么新增节点的next和prev都引用自身//任意位置的插入在位置后面插入public void AddIndex(int index,int data){ListNode nodenew ListNode(data);if(index0||indexsize()){throw new IndexOutOfBounds(任意位置插入坐标非法非法值为index);}if(index0){addFirst(data);return;}if(indexsize()){addLast(data);return;}//一般情况ListNode curhead;while(index!0){curcur.next;index--;}node.nextcur;cur.prev.nextnode;node.prevcur.prev;cur.prevnode;}//删除第一次出现关键字为key的节点public void remove(int key){//链表为空if(headnull){return;}//只有一个节点并且该节点值为keyif(head.nextnullhead.valkey){head.prevnull;head.nextnull;return;}//头节点if(head.valkey){head.next.prevnull;headhead.next;return;}//尾节点if(last.valkey){last.prev.nextnull;lastlast.prev;return;}//一般情况ListNode curhead;while(cur!null){if(cur.valkey){cur.prev.nextcur.next;cur.next.prevcur.prev;return;}curcur.next;}}//删除所有出现关键字为key的节点public void removeAll(int key){//链表为空if(headnull){return;}//只有一个节点并且该节点值为keyif(head.nextnullhead.valkey){head.prevnull;head.nextnull;return;}//头节点if(head.valkey){head.next.prevnull;headhead.next;}//尾节点if(last.valkey){last.prev.nextnull;lastlast.prev;}//一般情况ListNode curhead;while(cur!null){if(cur.valkey){cur.prev.nextcur.next;cur.next.prevcur.prev;}curcur.next;}}//clearpublic void clear(){ /* ListNode curhead;while(cur!null){ListNode curNextcur.next;//存储下一个节点方便下次循环使用cur.prevnull;cur.nextnull;curcurNext;//更新当前节点}*/headnull;lastnull;//使头节点和尾节点的地址置空}}IndexOutOfBounds public class IndexOutOfBounds extends RuntimeException{public IndexOutOfBounds() {}public IndexOutOfBounds(String message) {super(message);} }Test1 public class Test1 {public static void main(String[] args) {MyLinkedList myLinkedListnew MyLinkedList();myLinkedList.addFirst(34);myLinkedList.addFirst(3);myLinkedList.addFirst(4);myLinkedList.addFirst(340);myLinkedList.addFirst(344);myLinkedList.dispaly();System.out.println(myLinkedList.size());System.out.println(myLinkedList.contains(4));System.out.println(我是分割线);myLinkedList.addLast(-12);myLinkedList.addLast(-121);myLinkedList.addLast(-1222);myLinkedList.dispaly();myLinkedList.AddIndex(3,999);myLinkedList.dispaly();// myLinkedList.AddIndex(55,999);System.out.println(我是分割线);myLinkedList.remove(999);myLinkedList.dispaly();myLinkedList.remove(344);myLinkedList.dispaly();myLinkedList.addFirst(-12);myLinkedList.addLast(-12);myLinkedList.dispaly();myLinkedList.removeAll(-12);myLinkedList.dispaly();System.out.println(我是分割线);myLinkedList.clear();myLinkedList.dispaly();System.out.println(证明有空行);} }什么是LinkedList LinkedList的底层是双向链表结构(链表后面介绍)由于链表没有将元素存储在连续的空间中元素存储在单独的节点中然后通过引用将节点连接起来了因此在在任意位置插入或者删除元素时不需要搬移元素效率比较高。 LinkedList的使用 LinkedList的其他常用方法 LinkedList的遍历 ArrayList和LinkedList的区别
http://www.zqtcl.cn/news/824239/

相关文章:

  • 易语言做购物网站春节网站怎么做
  • 建公司网站设计网站公司做网上夫妻去哪个网站
  • 稷山网站建设wordpress单本小说采集
  • 凡客网站规划与建设ppt网站做跳转教程
  • 怎么看网站空间多大做网站旅游销售
  • 天津做手机网站建设旅游网站的目的
  • 飞机查询网站开发的创新点注册公司流程和费用大概多少钱
  • 高质量的邯郸网站建设厦门网页制作厦门小程序app
  • 建设企业网站企业网上银行官网官方二建证从住房建设厅网站调出流程
  • 网站开发和网站建设网页出现网站维护
  • 推广网站的方法电影网站建设教程
  • 哪些网站可以做相册视频成都企业网站公司
  • wordpress网站统计插件常见的管理信息系统有哪些
  • wordpress多个导航菜单seo引流软件
  • 建立网站需要多少钱怎么样企业邮箱在哪看
  • 网站主要功能2008服务器网站
  • 增城百度做网站多少钱it培训机构排名
  • 网站开发项目规划书四川建设网个人证书查询网址
  • 怎么模板建站微信做单30元一单
  • 兰州建设局网站十堰专业网站建设
  • html5 网站源码网络营销课程思政
  • 建设网站贵吗深圳网站建设推广论坛
  • 做网站需注意事项会员卡管理系统下载
  • 嘉兴高端网站建设公司电子信息工程能进国家电网吗
  • 建网站 广州网站改版 理论
  • 门户网站简称昆明本地网站
  • 网站定位的核心意义离婚协议书模板 完整版
  • 网站首页改版方案长图制作网站
  • 网站的栏目有什么名字保定网络公司网站
  • 南京建设机械网站建设银行网站解除绑定