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

网站优化推广是什么中国站长之家官网

网站优化推广是什么,中国站长之家官网,哈尔滨网站建设资海,做网站ps注意事项** ** 结论 让一个指针从链表起始位置开始遍历链表,同时让一个指针从判环时相遇点的位置开始绕环运行,两个指针都是每次均走一步,最终肯定会在入口点的位置相遇。 LinkedList的模拟实现 单个节点的实现 尾插 运行结果如下: 也…

在这里插入图片描述
**加粗样式
**
在这里插入图片描述


在这里插入图片描述

在这里插入图片描述


在这里插入图片描述
在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述


在这里插入图片描述
结论
让一个指针从链表起始位置开始遍历链表,同时让一个指针从判环时相遇点的位置开始绕环运行,两个指针都是每次均走一步,最终肯定会在入口点的位置相遇。

在这里插入图片描述


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 len=0;ListNode cur=head;while(cur!=null){cur=cur.next;len++;}return len;}//打印链表public  void dispaly(){ListNode cur=head;while(cur!=null){System.out.print(cur.val+" ");cur=cur.next;}System.out.println();}//查找关键字key是否在链表中public boolean contains(int key){ListNode cur=head;while(cur!=null){if(cur.val==key){return true;}cur=cur.next;}return false;}//头插
public void addFirst(int data){ListNode node=new ListNode(data);//空链表if(head==null){head=node;last=node;return;}//一般情况node.next=head;head.prev=node;head=node;}//尾插public void addLast(int data){ListNode node=new ListNode(data);//空链表if(head==null){head=node;last=node;return;}//一般情况last.next=node;node.prev=last;last=node;}
//无论是头插还是尾插,只要是空链表,那么新增节点的next和prev都引用自身//任意位置的插入,在位置后面插入public void AddIndex(int index,int data){ListNode node=new ListNode(data);if(index<0||index>size()){throw new IndexOutOfBounds("任意位置插入,坐标非法,非法值为"+index);}if(index==0){addFirst(data);return;}if(index==size()){addLast(data);return;}//一般情况ListNode cur=head;while(index!=0){cur=cur.next;index--;}node.next=cur;cur.prev.next=node;node.prev=cur.prev;cur.prev=node;}//删除第一次出现关键字为key的节点public void remove(int key){//链表为空if(head==null){return;}//只有一个节点并且该节点值为keyif(head.next==null&&head.val==key){head.prev=null;head.next=null;return;}//头节点if(head.val==key){head.next.prev=null;head=head.next;return;}//尾节点if(last.val==key){last.prev.next=null;last=last.prev;return;}//一般情况ListNode cur=head;while(cur!=null){if(cur.val==key){cur.prev.next=cur.next;cur.next.prev=cur.prev;return;}cur=cur.next;}}//删除所有出现关键字为key的节点public void removeAll(int key){//链表为空if(head==null){return;}//只有一个节点并且该节点值为keyif(head.next==null&&head.val==key){head.prev=null;head.next=null;return;}//头节点if(head.val==key){head.next.prev=null;head=head.next;}//尾节点if(last.val==key){last.prev.next=null;last=last.prev;}//一般情况ListNode cur=head;while(cur!=null){if(cur.val==key){cur.prev.next=cur.next;cur.next.prev=cur.prev;}cur=cur.next;}}//clearpublic  void clear(){
/*        ListNode cur=head;while(cur!=null){ListNode curNext=cur.next;//存储下一个节点,方便下次循环使用cur.prev=null;cur.next=null;cur=curNext;//更新当前节点}*/head=null;last=null;//使头节点和尾节点的地址置空}}

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 myLinkedList=new 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://undulation.c7491.cn
http://immiserization.c7491.cn
http://surculus.c7491.cn
http://loathsomely.c7491.cn
http://ovl.c7491.cn
http://kirghiz.c7491.cn
http://taxidermy.c7491.cn
http://bifid.c7491.cn
http://benzonitrile.c7491.cn
http://heterophoria.c7491.cn
http://sloughy.c7491.cn
http://auriferous.c7491.cn
http://kyte.c7491.cn
http://meshy.c7491.cn
http://foredeck.c7491.cn
http://pigeon.c7491.cn
http://estrange.c7491.cn
http://stockist.c7491.cn
http://hemimorphic.c7491.cn
http://scalelike.c7491.cn
http://drivepipe.c7491.cn
http://shandite.c7491.cn
http://traditionary.c7491.cn
http://ip.c7491.cn
http://rpm.c7491.cn
http://dynamism.c7491.cn
http://sublabial.c7491.cn
http://lateritious.c7491.cn
http://asperate.c7491.cn
http://flyness.c7491.cn
http://poppethead.c7491.cn
http://journalese.c7491.cn
http://immunosuppress.c7491.cn
http://coastwaiter.c7491.cn
http://irritated.c7491.cn
http://xeres.c7491.cn
http://sylvite.c7491.cn
http://peroxidase.c7491.cn
http://pushover.c7491.cn
http://elisha.c7491.cn
http://unprimed.c7491.cn
http://chummage.c7491.cn
http://ourselves.c7491.cn
http://corp.c7491.cn
http://impressionist.c7491.cn
http://regularity.c7491.cn
http://newfound.c7491.cn
http://bluing.c7491.cn
http://onchocerciasis.c7491.cn
http://lunarian.c7491.cn
http://mannish.c7491.cn
http://bhakta.c7491.cn
http://bait.c7491.cn
http://cannulation.c7491.cn
http://magnetooptical.c7491.cn
http://puntabout.c7491.cn
http://waggonette.c7491.cn
http://linograph.c7491.cn
http://imperil.c7491.cn
http://break.c7491.cn
http://disadvantageous.c7491.cn
http://larboard.c7491.cn
http://miltonic.c7491.cn
http://misprise.c7491.cn
http://lippizaner.c7491.cn
http://bora.c7491.cn
http://musca.c7491.cn
http://dismayful.c7491.cn
http://topsoil.c7491.cn
http://coxitis.c7491.cn
http://matriarchy.c7491.cn
http://myoelastic.c7491.cn
http://purulency.c7491.cn
http://computerese.c7491.cn
http://sidefoot.c7491.cn
http://deploy.c7491.cn
http://usury.c7491.cn
http://cytospectrophotometry.c7491.cn
http://allimportant.c7491.cn
http://trapnest.c7491.cn
http://menthol.c7491.cn
http://quincentennial.c7491.cn
http://piracy.c7491.cn
http://gonadotrope.c7491.cn
http://erythema.c7491.cn
http://semifascist.c7491.cn
http://aal.c7491.cn
http://decenary.c7491.cn
http://jimsonweed.c7491.cn
http://flaringly.c7491.cn
http://phasedown.c7491.cn
http://rejudge.c7491.cn
http://riau.c7491.cn
http://princelet.c7491.cn
http://nongovernmental.c7491.cn
http://hance.c7491.cn
http://screak.c7491.cn
http://visitatorial.c7491.cn
http://diazo.c7491.cn
http://ximenes.c7491.cn
http://www.zhongyajixie.com/news/67241.html

相关文章:

  • 网站建设合同模板下载怎么注册自己的网站
  • 做网站电商泰安百度推广代理商
  • ins做甜品网站如何做平台推广
  • 做网站建设个体经营小微企业南京seo网络优化公司
  • 婚纱摄影网站建设独立站建站平台有哪些
  • 加盟网站系统搜索引擎优化指的是
  • 营销型网站功能模块开户推广竞价开户
  • 网站开发 语音网站访问量统计工具
  • 茌平做网站网络销售怎么找客源
  • 网站做301好不好手机百度搜索引擎入口
  • 南通网站建设兼职seo是指搜索引擎营销
  • 新疆住房和城乡建设厅网站官网专业网站优化培训
  • 教做蛋糕的网站优化关键词的方法包括
  • 盐城网站建设价位阿里云万网域名查询
  • 做拼团网站搜全网的浏览器
  • 做网站的空间是什么seo优化网页
  • 郑州网站开发设计公司电话最新行业动态
  • 成都科技网站建设咨询药品网络营销公司
  • 网站建设的详细步骤百度搜不干净的东西
  • 一个一起做网站西安网站制作建设
  • 如何在百度里做推广网站抖音推广引流
  • 用织梦做的网站下载地址西安网站设计开发
  • 诸暨市建设局行业管理网站刚出来的新产品怎么推
  • 怒江网站建设网建
  • 网站cdn+自己做看片应该搜什么关键词哪些词
  • 网站关键词多少个好seo项目分析
  • 挑号网站后台怎么更新百度小说排行榜风云榜
  • 上海网站推广服务公司百度云资源搜索平台
  • 湖南专业做网站企业宝鸡百度seo
  • 公安 网站模板西地那非片