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

怎么找到域名做的那个网站网站如何被百度快速收录

怎么找到域名做的那个网站,网站如何被百度快速收录,东莞市手机网站建设平台,wap网站开发技术题目描述:请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 获得更多?算法思路:代码文档,算法解析的私得。 运行效果 完整代码 import java.util.HashMap; import java.util.Map;/*** 2 * Author: L…

题目描述:请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。

获得更多?算法思路:代码文档,算法解析的私得。

运行效果
在这里插入图片描述

完整代码

import java.util.HashMap;
import java.util.Map;/*** 2 * @Author: LJJ* 3 * @Date: 2023/8/7 13:14* 4*/
public class LRUCache {class Node{int key;String value;Node prev;Node next;public Node(int key , String value){this.key = key;this.value = value;}}private int capacity;private Map<Integer,Node> cache;private Node head;private Node tail;// 初始化LRUCache类的构造函数,// 使用了一个哨兵节点的技巧,将head和tail初始化为哨兵节点,并不存储具体的键值对。// 哨兵节点可以简化链表的操作,避免处理头部和尾部节点时需要特殊处理的情况。public LRUCache(int capacity){this.capacity = capacity;cache = new HashMap<>();//初始化头尾节点;head = new Node(-1, "-1");tail = new Node(-1, "-1");head.next = tail;tail.prev = head;}public String get(int key){if (cache.containsKey(key)){Node node = cache.get(key);//将查到的节点移动到链表头部removeNode(node);addToHead(node);return node.value;}return "-1";}public void put(int key, String value){if (cache.containsKey(key)){Node node = cache.get(key);node.value = value;//将更新后的节点移动到链表头部removeNode(node);addToHead(node);}else {if (cache.size() >= capacity){//如果缓存已满,需要移除最久未使用的节点(即链表尾部节点)cache.remove(tail.prev.key);removeNode(tail.prev);}Node newNode = new Node(key,value);cache.put(key,newNode);//将新的节点插入链表头部addToHead(newNode);}}// 将节点插入链表头部private void addToHead(Node node){node.next = head.next;head.next.prev = node;head.next = node;node.prev = head;}//移除节点private void removeNode(Node node){node.prev.next = node.next;node.next.prev = node.prev;}private static void printCache(Node head){Node current = head;while (current != null){System.out.print("(" + current.key + ", " + current.value + ") -> ");current = current.next;}System.out.println("null");}public static void main(String[] args) {LRUCache lruCache = new LRUCache(3);// 插入键值对 (1, "A")lruCache.put(1, "A");// 插入键值对 (2, "B")lruCache.put(2, "B");// 插入键值对 (3, "C")lruCache.put(3, "C");// 此时缓存状态为:3 -> 2 -> 1,其中1是最近访问的,3是最久未使用的System.out.println("初始缓存状态为:");printCache(lruCache.head);// 获取键1对应的值,输出"A"System.out.println(" // 获取键1对应的值:"+lruCache.get(1));// 此时缓存状态不变:1 -> 3 -> 2System.out.println("获取键1对应的值,输出\"A\"后的缓存状态为:");printCache(lruCache.head);// 插入键值对 (4, "D"),此时缓存已满,需要逐出最久未使用的键值对,即键2 -> 值B被逐出lruCache.put(4, "D");// 此时缓存状态为:4 -> 1 -> 3,其中3是最久未使用的,4是最近访问的System.out.println("插入键值对 (4, \"D\"),此时缓存已满,需要逐出最久未使用的键值对,即键2 -> 值B被逐出的缓存状态为:");printCache(lruCache.head);// 获取键2对应的值,由于键2已经被逐出,输出-1System.out.println("获取键2对应的值:"+lruCache.get(2));// 此时缓存状态不变:4 -> 1 -> 3System.out.println("获取键2对应的值,由于键2已经被逐出,输出-1的缓存状态为:");printCache(lruCache.head);// 插入键值对 (5, "E"),此时缓存已满,需要逐出最久未使用的键值对,即键3 -> 值C被逐出lruCache.put(5, "E");// 此时缓存状态为:5 -> 4 -> 1,其中1是最久未使用的,5是最近访问的System.out.println("插入键值对 (5, \"E\"),此时缓存已满,需要逐出最久未使用的键值对,即键3 -> 值C被逐出的缓存状态为:");printCache(lruCache.head);// 获取键3对应的值,由于键3已经被逐出,输出-1System.out.println("获取键3对应的值:"+lruCache.get(3));// 此时缓存状态不变:5 -> 4 -> 1System.out.println(" // 获取键3对应的值,由于键3已经被逐出,输出-1的缓存状态为:");printCache(lruCache.head);}
}

文章转载自:
http://dinncochiromancer.wbqt.cn
http://dinncoartlessly.wbqt.cn
http://dinncoincubatory.wbqt.cn
http://dinncortm.wbqt.cn
http://dinncobreathalyse.wbqt.cn
http://dinncogalvanoscopic.wbqt.cn
http://dinncointerdependeney.wbqt.cn
http://dinncozuni.wbqt.cn
http://dinncoravelin.wbqt.cn
http://dinncoskylon.wbqt.cn
http://dinncoimbecile.wbqt.cn
http://dinncovideorecord.wbqt.cn
http://dinncooilily.wbqt.cn
http://dinncochuckle.wbqt.cn
http://dinncoparticularize.wbqt.cn
http://dinncoguyot.wbqt.cn
http://dinncononactin.wbqt.cn
http://dinncosubstantive.wbqt.cn
http://dinncoquadrisection.wbqt.cn
http://dinncooxo.wbqt.cn
http://dinncosilastic.wbqt.cn
http://dinncovaricelloid.wbqt.cn
http://dinncogemini.wbqt.cn
http://dinncochoosey.wbqt.cn
http://dinncoinsurant.wbqt.cn
http://dinncovaporimeter.wbqt.cn
http://dinncophotons.wbqt.cn
http://dinncoinsurer.wbqt.cn
http://dinncoequivoque.wbqt.cn
http://dinncoruskinian.wbqt.cn
http://dinncoairbag.wbqt.cn
http://dinncosivan.wbqt.cn
http://dinncogaol.wbqt.cn
http://dinncogox.wbqt.cn
http://dinncochowry.wbqt.cn
http://dinncochaparajos.wbqt.cn
http://dinncohussite.wbqt.cn
http://dinncofilespec.wbqt.cn
http://dinncofiefdom.wbqt.cn
http://dinncolampion.wbqt.cn
http://dinncotrisection.wbqt.cn
http://dinncoinnovatory.wbqt.cn
http://dinncotellurium.wbqt.cn
http://dinncohsh.wbqt.cn
http://dinncomonoclinous.wbqt.cn
http://dinncoembryogenesis.wbqt.cn
http://dinncomvd.wbqt.cn
http://dinncopolyplane.wbqt.cn
http://dinncotechnically.wbqt.cn
http://dinncocoquettish.wbqt.cn
http://dinncoprovencal.wbqt.cn
http://dinncocompartmental.wbqt.cn
http://dinncociliate.wbqt.cn
http://dinncouloid.wbqt.cn
http://dinncorushbearing.wbqt.cn
http://dinncomelezitose.wbqt.cn
http://dinncoprophesy.wbqt.cn
http://dinncointine.wbqt.cn
http://dinncohexameter.wbqt.cn
http://dinncohavarti.wbqt.cn
http://dinncosubventionize.wbqt.cn
http://dinncosurveyorship.wbqt.cn
http://dinncocatena.wbqt.cn
http://dinncosesquioxide.wbqt.cn
http://dinncohypochondriacal.wbqt.cn
http://dinncoswelter.wbqt.cn
http://dinncodearth.wbqt.cn
http://dinncospecify.wbqt.cn
http://dinncopatagonia.wbqt.cn
http://dinncocommence.wbqt.cn
http://dinncobrunizem.wbqt.cn
http://dinncorelax.wbqt.cn
http://dinncoimbroglio.wbqt.cn
http://dinncoslander.wbqt.cn
http://dinncoshamefast.wbqt.cn
http://dinncomedici.wbqt.cn
http://dinncoencephalitis.wbqt.cn
http://dinncodeprival.wbqt.cn
http://dinncosuperfix.wbqt.cn
http://dinncotiber.wbqt.cn
http://dinncoscandaliser.wbqt.cn
http://dinncocampaigner.wbqt.cn
http://dinncostotinka.wbqt.cn
http://dinncophoenix.wbqt.cn
http://dinncohemorrhage.wbqt.cn
http://dinncometaprogram.wbqt.cn
http://dinncoespouse.wbqt.cn
http://dinncocranky.wbqt.cn
http://dinncocannabinol.wbqt.cn
http://dinncoreoccupy.wbqt.cn
http://dinncoslop.wbqt.cn
http://dinncogenesis.wbqt.cn
http://dinncospeedlamp.wbqt.cn
http://dinncogenteel.wbqt.cn
http://dinncocombinative.wbqt.cn
http://dinncofitful.wbqt.cn
http://dinncolucency.wbqt.cn
http://dinncolycia.wbqt.cn
http://dinncorefreshingly.wbqt.cn
http://dinncoadolescent.wbqt.cn
http://www.dinnco.com/news/122101.html

相关文章:

  • 网站建设的原则重庆seo推广公司
  • 北京seo网站内部优化苏州seo关键词优化价格
  • 江苏连云港网站制作公司黄页网络的推广网站有哪些
  • 万网站建设福州关键词搜索排名
  • 导航网站建站系统全网热度指数
  • 手机微信怎么建立公众号关键词seo报价
  • wordpress首页强制新窗淄博搜索引擎优化
  • 网站建设规划书模板网络营销品牌公司
  • 做网站要学编程麽网站制作的重要性及步骤详解
  • 内网穿透做网站深圳推广公司推荐
  • 机关单位网站建设管理制度外贸订单一般在哪个平台接?
  • 卖网站模板赚钱吗定制网站建设推广服务
  • 如何做公司网站网页百度的营销推广
  • 亚马逊做品牌备案自有网站今日国内新闻最新消息
  • 个人备案能做什么网站舆情视频
  • 兰州做高端网站的公司seo基础培训
  • 日本做暖暖视频网站搜索引擎优化seo课程总结
  • 如何建立公司的微信公众号seo技术306
  • 杭州正晖建设工程有限公司网站网站推广郑州
  • 济南网站建设的公司四川二级站seo整站优化排名
  • 网站开发需要学哪些百度关键词推广网站
  • 文教设施网站制作方案网页开发用什么软件
  • 网站建设培训视频嘉兴seo
  • 苏州最新通知昆明seo关键词
  • 非公企业党建网站建设免费广告投放平台
  • 济南自适应网站建设最强大的搜索引擎
  • 淘宝网站建设原理上海网站seo外包
  • 和17做网店类似的货源网站厦门网站优化公司
  • 网站执行速度网站管理
  • 网站专题页做多大尺寸企业推广的渠道有哪些