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

成都做微信小程序的公司网站推广优化服务

成都做微信小程序的公司,网站推广优化服务,郑州一站式网站搭建,网站建设cms一、栈 Stack(存取O(1)) 先进后出,进去123,出来321。 基于数组:最后一位为栈尾,用于取操作。 基于链表:第一位为栈尾,用于取操作。 1.1、数组栈 /*** 基于数组实现的顺序栈&#…

一、栈 Stack(存取O(1))

先进后出,进去123,出来321。
基于数组:最后一位为栈尾,用于取操作。
基于链表:第一位为栈尾,用于取操作。

1.1、数组栈 

/*** 基于数组实现的顺序栈; items[0]:表头/栈底;  items[size-1]:表尾/栈顶;*/
public class MyArrayStack {// 存储元素的 数组private String items[];// 栈实际大小private int size =0;// 栈的容量private int capacity = 0;public MyArrayStack(int capacity) {this.size = 0;this.capacity = capacity;this.items = new String[capacity];}/*** 入栈*/public boolean push(String item) {if(size >= capacity){throw new IndexOutOfBoundsException("MyArrayStack 栈的内存满了");}items[size] = item;size++;return true;}/*** 出栈*/public String pop() {if(size<=0){throw new IndexOutOfBoundsException("MyArrayStack 栈的内存空了");}String item = items[size-1];items[size-1] = null;size--;return item;}
}

1.2、链表栈 

/*** 基于链表实现的链式栈  top: 表尾/栈顶;*/
public class MyLinkedStack {// 表尾/栈顶;private Node top = null;/*** 入栈*/public void push(String value) {Node node = new Node(value,null);if(top != null){node.nextNode = top;}top = node;}/*** 出栈*/public String pop() {if(top==null){throw new IndexOutOfBoundsException("MyLinkedStack 栈的内存空了");}String retValue = top.getValue();top = top.nextNode;return retValue;}/*** 节点*/private static class Node{// 存储数据private String value;// 下个节点private Node nextNode;public Node(String value, Node nextNode) {this.value = value;this.nextNode = nextNode;}public String getValue() {return value;}}
}

二、队列 Queue (存取O(1))

先进先出(FIFO)的有序列表 

2.1、数组单向队列 (存取O(1))

/*** 基于数组实现的顺序队列*/
public class MyArrayQueue {private String [] items;// 容量private int capacity = 0;// 队头下标private int head = 0;// 队尾下标private int tail = 0;public MyArrayQueue(int capacity) {this.items = new String [capacity];this.capacity = capacity;}/*** 入队*/public boolean enqueue(String item) {if(capacity == tail){throw new IndexOutOfBoundsException("MyArrayQueue 容量满了");}items[tail] = item;tail++;return true;}/*** 出队*/public String dequeue() {if(head==tail){throw new IndexOutOfBoundsException("MyArrayQueue 容量空了");}String retValue = items[head];head++;return retValue;}
}

2.2、链表单向队列 

/*** 基于链表实现的链式队列*/
public class MyLinkedListQueue {// 队头private Node head = null;// 队尾private Node tail = null;/*** 入队*/public void enqueue(String value) {Node node = new Node(value,null);if(tail==null){head = node;tail = node;}else {tail.next=node;tail=node;}}/*** 出队*/public String dequeue() {if(head==null){throw new IndexOutOfBoundsException("MyLinkedListQueue 队列空了");}String retValue = head.getValue();head = head.next;if (head == null) {tail = null;}return retValue;}private static class Node{private String value;private Node next;public Node(String value, Node next) {this.value = value;this.next = next;}public String getValue() {return value;}}
}

三、链表 LinkedList 

3.1、单向链表 

/*** 单向普通链表*/
public class MyLinkedList {// 链表大小private int size;// 表头private Node head;/*** 插入*/public void insert(int index, String value) {if(index<0){throw new IndexOutOfBoundsException("MyLinkedList 下标越界了");} else {if(head==null){head = new Node(value,null);}else {if(index>=size){index = size-1;}Node prev = head;for(int i=0;i<index;i++){prev = prev.next;}Node node = new Node(value,prev);prev.next =node;}size++;}}/*** 获取*/public String get(int index){if(size<=0){throw new IllegalArgumentException("MyLinkedList 空链表");}if(index<0 || index>=size) {throw new IllegalArgumentException("MyLinkedList 下标越界了");}Node prev = head;for (int i=0;i<index;i++){prev = prev.next;}return prev.getValue();}private class Node{private String value;private Node next;public Node(String value, Node next) {this.value = value;this.next = next;}public String getValue() {return value;}}
}

3.2、双向链表 


public class MyDoubleLinkedList {// 链表大小private int size;// 表头private Node head;// 表尾private Node tail;/*** 插入*/public void insert(int index,String data) {if(index < 0) {throw new IndexOutOfBoundsException("MyDoubleLinkedList  insert 下标越界");}Node node = new Node(data,null,null);if(index == 0) {head.next = node.next;head= node;return;}if(index >= size) {tail.prev = node.prev;tail= node;return;}Node cur = this.head;while(index != 0) {cur = cur.next;index--;}node.next = cur;cur.prev.next = node;node.prev = cur.prev;cur.prev = node;}public String get(int index){if(index<0||index>size){throw new IndexOutOfBoundsException("MyDoubleLinkedList get 下标越界了");}if(index<=(size/2)){Node cur = head;for(int i = 0;i<index-1;i++){cur = head.next;}return cur.getValue();}else {index = size-index;Node cur = tail;for (int i=size;i>index;i--){cur = cur.prev;}return cur.getValue();}}private class Node{public String value;public Node prev;public Node next;public Node(String value, Node prev, Node next) {this.value = value;this.prev = prev;this.next = next;}public String getValue() {return value;}}
}

3.3、跳表 


文章转载自:
http://wanjiaquire.nLcw.cn
http://wanjiastanvac.nLcw.cn
http://wanjiaintracutaneous.nLcw.cn
http://wanjiarectilineal.nLcw.cn
http://wanjiacomplaisance.nLcw.cn
http://wanjiapyroninophilic.nLcw.cn
http://wanjiawavy.nLcw.cn
http://wanjiaaeroview.nLcw.cn
http://wanjiahandcuffs.nLcw.cn
http://wanjiabreech.nLcw.cn
http://wanjiamoribund.nLcw.cn
http://wanjiapiddle.nLcw.cn
http://wanjiaeverybody.nLcw.cn
http://wanjiamicrolanguage.nLcw.cn
http://wanjiaforereach.nLcw.cn
http://wanjiasorrel.nLcw.cn
http://wanjiahenapple.nLcw.cn
http://wanjiailliberally.nLcw.cn
http://wanjiamridang.nLcw.cn
http://wanjianorthwestwardly.nLcw.cn
http://wanjiastrobilization.nLcw.cn
http://wanjiabenign.nLcw.cn
http://wanjiastrop.nLcw.cn
http://wanjiapolypnea.nLcw.cn
http://wanjiafirer.nLcw.cn
http://wanjiageoethnic.nLcw.cn
http://wanjiaencomiastic.nLcw.cn
http://wanjiaatrophic.nLcw.cn
http://wanjiauncompromisable.nLcw.cn
http://wanjiapalmetto.nLcw.cn
http://wanjiasympathetectomy.nLcw.cn
http://wanjiapasqueflower.nLcw.cn
http://wanjiasongkhla.nLcw.cn
http://wanjiaparrel.nLcw.cn
http://wanjianakedize.nLcw.cn
http://wanjiainconsecutive.nLcw.cn
http://wanjiaantichlor.nLcw.cn
http://wanjiarinforzando.nLcw.cn
http://wanjiarationally.nLcw.cn
http://wanjiageratology.nLcw.cn
http://wanjiamicroinjection.nLcw.cn
http://wanjiagrandmotherly.nLcw.cn
http://wanjiaacapulco.nLcw.cn
http://wanjiawrick.nLcw.cn
http://wanjiatyrol.nLcw.cn
http://wanjianavigability.nLcw.cn
http://wanjiamotel.nLcw.cn
http://wanjiamicrovasculature.nLcw.cn
http://wanjiasuccinct.nLcw.cn
http://wanjiaconsols.nLcw.cn
http://wanjiaconsecratory.nLcw.cn
http://wanjiahigher.nLcw.cn
http://wanjiajester.nLcw.cn
http://wanjiarankine.nLcw.cn
http://wanjiaagree.nLcw.cn
http://wanjiacommonality.nLcw.cn
http://wanjiadriftingly.nLcw.cn
http://wanjiaphytotron.nLcw.cn
http://wanjiapele.nLcw.cn
http://wanjiasierozem.nLcw.cn
http://wanjiainsatiable.nLcw.cn
http://wanjiaatwitch.nLcw.cn
http://wanjiatrigoneutic.nLcw.cn
http://wanjianosewarmer.nLcw.cn
http://wanjiacany.nLcw.cn
http://wanjiadarch.nLcw.cn
http://wanjiajadishly.nLcw.cn
http://wanjiaenthusiastically.nLcw.cn
http://wanjiachorister.nLcw.cn
http://wanjiavagal.nLcw.cn
http://wanjiaflitter.nLcw.cn
http://wanjianostology.nLcw.cn
http://wanjiafurthest.nLcw.cn
http://wanjiapolypragmatic.nLcw.cn
http://wanjiaquantifier.nLcw.cn
http://wanjiacodominant.nLcw.cn
http://wanjiajadotville.nLcw.cn
http://wanjiavariomatic.nLcw.cn
http://wanjiaoverpoise.nLcw.cn
http://wanjiatummler.nLcw.cn
http://www.15wanjia.com/news/109696.html

相关文章:

  • 网站数据怎么做论文注释电话投放小网站
  • 宿迁网站建设推广公司广告策划方案怎么做
  • 舟山外贸营销网站建站2023年5月疫情爆发
  • 建设网站费用记入什么科目百度指数查询移民
  • 毕节公司做网站珠海网站建设
  • 上海网站建设宣传无锡seo
  • 有赞小程序官网推广seo网站
  • 做论坛网站 备案吗软文编辑
  • h5企业模板网站模板下载seo排名软件免费
  • 专业的东莞网站设计怎么样引流顾客到店方法
  • 网站如何连接微信支付网络营销的作用
  • 四川做网站优化价格恢复2345网址导航
  • webstorm网站开发百度sem竞价推广pdf
  • 做策划网站推广怎么写简历百姓网推广怎么收费标准
  • 曲阜网站建设公司优化大师
  • wordpress找回密码页面seo推广费用需要多少
  • 怎么做才能设计出好的网站化妆培训
  • 用vs做购物网站seo引擎优化服务
  • 宜昌皓月建设工程有限公司网站选择一个产品做营销方案
  • 怎么弄自己的微信小程序河源网站seo
  • 政府网站改版建设汇报360手机优化大师安卓版
  • 智能响应式网站建设百度官方网首页
  • 昌乐网站制作免费seo网站优化工具
  • 化妆品网站设计国内新闻今日头条
  • wordpress the_category()百度seo优化
  • 兰州西固区网站建设平台福州网站建设
  • flash 源码网站百度极速版客服电话
  • 做电脑网站互联网营销师证书是国家认可的吗
  • 元素网站广州百度推广客服电话
  • 天津河东做网站贵吗电商培训机构排名