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

手机网站营销方法wordpress微信启动

手机网站营销方法,wordpress微信启动,wordpress 外贸主题,网站后台做完文章不显示前言 大家好,我是Maybe。最近在学习数据结构中的链表,自己手动实现了一个LinkedList。我想与大家分享一下。 思维导图 代码部分 package Constant;public class constant {public static final String INDEX_IS_WRONG"输入的下标不合法"; }p…

前言

大家好,我是Maybe。最近在学习数据结构中的链表,自己手动实现了一个LinkedList。我想与大家分享一下。

思维导图

代码部分

package Constant;public class constant {public static final String INDEX_IS_WRONG="输入的下标不合法";
}
package utils;public class IndexException extends RuntimeException{public IndexException() {super();}public IndexException(String message) {super(message);}
}
public interface IList {// 头插法public void addFirst(int data);// 尾插法public void addLast(int data);// 任意位置插入,第一个数据节点为0号下标public void addIndex(int index,int data);// 查找是否包含关键字key是否在单链表当中public boolean contains(int key);// 删除第一次出现关键字为key的节点public void remove(int key);// 删除所有值为key的节点public void removeAllKey(int key);// 得到链表的长度public int size();public void display();public void clear();
}
import Constant.constant;
import utils.IndexException;public class LinkedList implements IList {//1.定义一个内部类static class ListNode{public int val;//类型写成了String,应该是ListNode的public ListNode prev;public ListNode next;public ListNode(int val) {this.val = val;}}public ListNode head;//这个就要给个尾了public ListNode last;@Overridepublic void addFirst(int data) {if(head==null){ListNode node=new ListNode(data);head=last=node;}else{ListNode node=new ListNode(data);node.next=head;head.prev=node;head=node;}}@Overridepublic void addLast(int data) {if(head==null){ListNode node=new ListNode(data);//写成了node=last=null了head=last=node;}else{ListNode node=new ListNode(data);last.next=node;node.prev=last;//这里要注意last=last.next;}}@Override//在LinkedList中找到对应的cur,然后再cur之前插入public void addIndex(int index, int data) {int len=size();if(index<0||index>len){String msg= constant.INDEX_IS_WRONG+index;throw new IndexException(msg);}if(index==0){addFirst(data);}else if(index==len){addLast(data);}else{ListNode node=new ListNode(data);ListNode cur=findIndex(index);node.next=cur;cur.prev.next=node;node.prev=cur.prev;cur.prev=node;}}//在LinkedList中找到对应的curprivate ListNode findIndex(int index){if(head==null){return null;}else{ListNode cur=head;while(index!=0){cur=cur.next;index--;}return cur;}}@Overridepublic boolean contains(int key) {if(head==null){return false;}else{ListNode cur=head;while(cur!=null){if(cur.val==key){return true;}else{cur=cur.next;}}return false;}}@Overridepublic void remove(int key) {//1.先判断链表是否为空if(head==null){return;}else{ListNode cur=head;while(cur!=null){if(cur.val==key){//1.考虑头删的情况if(cur==head){head=head.next;//考虑如果链表中只有一个节点的情况if(head!=null){head.prev=null;}}else{cur.prev.next=cur.next;//尾巴节点和中间节点共用if(cur.next==null){//尾节点last=last.prev;}else{//中间节点cur.next.prev=cur.prev;}}return;}cur=cur.next;}}}@Overridepublic void removeAllKey(int key) {if(head==null){return;}else{ListNode cur=head;while(cur!=null){if(cur.val==key){if(cur==head){head=head.next;//只有一个节点的情况要考虑if(head!=null){head.prev=null;}}else{cur.prev.next=cur.next;if(cur.next==null){last=last.next;}else{cur.next.prev=cur.prev;}}}cur=cur.next;}}}@Overridepublic int size() {if(head==null){return 0;}else{ListNode cur=head;int count=0;while(cur!=null){cur=cur.next;count++;}return count;}}@Overridepublic void display() {if(head==null){return;}else{ListNode cur=head;while(cur!=null){System.out.print(cur.val+" ");cur=cur.next;}System.out.println();}}@Overridepublic void clear() {if(head==null){return;}else{ListNode cur=head;while(cur!=null){ListNode curN=cur.next;cur.prev=null;cur.next=null;cur=curN;}head=last=null;//最后要把head和last置为null}}
}
import utils.IndexException;public class Test {public static void main(String[] args) {LinkedList linkedList=new LinkedList();linkedList.addLast(1);linkedList.addLast(1);linkedList.addLast(1);linkedList.addLast(2);linkedList.display();
//        linkedList.addFirst(1);
//        linkedList.addFirst(2);
//        linkedList.addFirst(3);
//        linkedList.addFirst(4);
//        linkedList.display();
//        int ret=linkedList.size();
//        System.out.println(ret);
//        try{
//            linkedList.addIndex(2,100);
//
//        }catch (IndexException e){
//            e.printStackTrace();
//        }
//        linkedList.display();
//        linkedList.remove(1);
//        linkedList.display();
//        linkedList.removeAllKey(1);linkedList.clear();linkedList.display();}
}

结语 

本次分享到此结束啦。希望可以帮到有需要的人!

 

 

 

 

 

 


文章转载自:

http://Ivf5GS9S.tpLht.cn
http://D4kpS19N.tpLht.cn
http://NwxCmExn.tpLht.cn
http://JCcQDtoR.tpLht.cn
http://lWrZvmb8.tpLht.cn
http://MXuX24Me.tpLht.cn
http://yNoFVSRg.tpLht.cn
http://ic9eVeKq.tpLht.cn
http://KxwWGoW3.tpLht.cn
http://zOwblRCU.tpLht.cn
http://Zm5uQU53.tpLht.cn
http://QKZHVm52.tpLht.cn
http://DS8IKLzf.tpLht.cn
http://B020nCIx.tpLht.cn
http://OUDZwx4F.tpLht.cn
http://0BH3VAaB.tpLht.cn
http://teQk2MeO.tpLht.cn
http://DL78oQfN.tpLht.cn
http://YPtwJY6o.tpLht.cn
http://pJD8Df3d.tpLht.cn
http://2KU96tHp.tpLht.cn
http://Qt5Mu5Q3.tpLht.cn
http://BzqUWwi6.tpLht.cn
http://UdjN7pX7.tpLht.cn
http://mxtcQY0d.tpLht.cn
http://FwwOhcqV.tpLht.cn
http://blIQYsv5.tpLht.cn
http://mYkIOslJ.tpLht.cn
http://8K4kYizX.tpLht.cn
http://6BRvR2wt.tpLht.cn
http://www.dtcms.com/wzjs/753664.html

相关文章:

  • 淄博网站制作设计公司添加网站绑定主机名
  • 积分网站运营建设投标书seo搜索引擎优化试题及答案
  • 发布外链网站办公室设计公司专业网站
  • 怎么加php网站登陆源码wordpress大前端4.1
  • 站长工具2023最新国产厦门的网站
  • 湖北省建设局网站网站维护费
  • 公司做网站域名的好处网络营销教案
  • 重庆有哪些网站口碑好的企业网站开发
  • 企业网站推广建设哈尔滨市建设工程信息网黑龙江
  • 跨境电商diy定制平台网站优化软件哪个好
  • 酒吧网站建设报价模板搜狗怎么做网站
  • 成都模板网站建设服务网站开发项目经理
  • 国外好用的网站推广赚钱软件
  • 新网站多久会被百度收录网站图片切换
  • 一家专门做打折的网站网站seo做哪些工作
  • 广州旅游网站建设设计公司北京网站备案拍照的地点
  • 苏州广告设计制作公司手机优化电池充电是什么意思
  • 网站设计评价标准免费网站模版
  • 织梦菜谱网站模板免费下载深圳企业网站改版
  • 廉溪区建设局网站专门做封面的网站
  • 常州自助做网站个人网站备案需要盖章吗
  • 电影下载网站 怎么做响应式手机网站制作
  • 做企业网站应该注意什么用dw怎麼做网站
  • 广西住房和城乡建设官方网站深圳外贸网站设计公司
  • 天津宇昊建设集团有限公司网站重庆网站建设cqsday
  • 外贸网站每天多少ip看广告收益最高的软件
  • 网站无备案网页设计html代码大全关于原神
  • 网站服务器空间选择wordpress mysql8.0
  • 网站建站一本通如何去建立和设计一个公司网站
  • 手机网站后台编辑器有哪些中山市网站开发外包公司