初识Sentinel--雪崩问题及其解决方法
摘要:什么是雪崩问题? 雪崩问题:微服务调用链中的某个服务故障,引起整个链路中的所有微服务不可用。 解决雪崩问题的常见四种方式: ①超时处理:设定超时时长,请求超过一定时间没有响应就返回错误信息,不会无休止的等待。 为什么说超时处理只是缓解了雪崩问题? 因为超时处理的处理情景下,在设定等待时间的情况下,如
阅读全文
posted @
2022-07-31 15:33
网恋被骗两千八
阅读(159)
推荐(0) 编辑
链表与递归----力扣203题
摘要:力扣算法203题--移除链表元素 public class ListNode { int val; ListNode next; ListNode() { } ListNode(int val) { this.val = val; } ListNode(int val, ListNode next)
阅读全文
posted @
2022-07-28 21:07
网恋被骗两千八
阅读(18)
推荐(0) 编辑
使用链表实现栈
摘要:public class LinkedListStack<E> implements Stack<E> { private LinkedList<E> list; public LinkedListStack(){ list = new LinkedList<>(); } @Override pub
阅读全文
posted @
2022-07-27 21:05
网恋被骗两千八
阅读(22)
推荐(0) 编辑
从链表中删除元素
摘要://删除链表中第index(o-based)个位置的元素,返回删除的全速 //在链表中不是一个常用的操作,练习用:) public E remove(int index) { if (index < 0 || index > size) throw new IllegalArgumentExcept
阅读全文
posted @
2022-07-26 21:50
网恋被骗两千八
阅读(41)
推荐(0) 编辑
链表的遍历,查询和修改
摘要:public class LinkedList<E> { private class Node { public E e; public Node next; public Node(E e, Node next) { this.e = e; this.next = next; } public N
阅读全文
posted @
2022-07-26 21:31
网恋被骗两千八
阅读(83)
推荐(0) 编辑
为链表设置虚拟头节点---接上篇
摘要:public class LinkedList<E> { private class Node { public E e; public Node next; public Node(E e, Node next) { this.e = e; this.next = next; } public N
阅读全文
posted @
2022-07-25 21:59
网恋被骗两千八
阅读(26)
推荐(0) 编辑
链表
摘要:为什么链表很重要? 链表是真正的动态数组。 是最简单的动态数据结构。 更深入的理解引用(或者指针)。 更深入的理解递归。 它可以用来辅助组成其他数据结构。 链表LinkedList 数据存储在节点(Node)中。 Class Node { E e; Node next; } 优点:真正的动态,不需要
阅读全文
posted @
2022-07-25 21:51
网恋被骗两千八
阅读(22)
推荐(0) 编辑
数组队列和循环队列的区别
摘要:package com.practice;import java.util.Random;public class Main { //测试使用queue运行opCount个enqueue和dequeue操作所需要的时间,单位:秒 private static double testQueue(Que
阅读全文
posted @
2022-07-14 19:49
网恋被骗两千八
阅读(23)
推荐(0) 编辑
循环队列的实现
摘要:package com.practice; public class LoopQueue<E> implements Queue<E> { private E[] data; private int front,tail; private int size; public LoopQueue(int
阅读全文
posted @
2022-07-13 21:17
网恋被骗两千八
阅读(23)
推荐(0) 编辑
队列 Queue
摘要:public interface Queue<E> { int getSize(); boolean isEmpty(); void enqueue(E e); E dequeue(); E getFront(); } package com.practice; import com.practic
阅读全文
posted @
2022-07-12 21:45
网恋被骗两千八
阅读(17)
推荐(0) 编辑
栈的实现
摘要:public interface Stack<E> { int getSize(); boolean isEmpty(); void push(E e); E pop(); E peek(); } package com.practice; import com.practice.Array.Arr
阅读全文
posted @
2022-07-11 21:30
网恋被骗两千八
阅读(15)
推荐(0) 编辑
简单的时间复杂度分析
摘要:O(1),O(n),O(lgn),O(nlgn),O(n^2) 大O描述的是算法的运行时间和输入数据之间的关系 public static int sum(int[] nums){ int sum = 0 ; for(int num : nums) sum += num ; return sum;
阅读全文
posted @
2022-07-06 21:26
网恋被骗两千八
阅读(39)
推荐(0) 编辑
数据结构之动态数组--接上篇
摘要://重置数组大小长度 private void resize(int newCapacity){ E[] newData = (E[]) new Object[newCapacity]; for(int i = 0 ; i < size ; i ++) newData[i] = data[i]; d
阅读全文
posted @
2022-07-05 12:22
网恋被骗两千八
阅读(20)
推荐(0) 编辑