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

wordpress无法打开网页如何优化seo

wordpress无法打开网页,如何优化seo,网站如何做app,网站付款链接怎么做的文章目录 概述实现创建节点查找节点增加节点查找后驱值根据关键词删除找到树中所有小于key的节点的value 概述 二叉搜索树,它具有以下的特性,树节点具有一个key属性,不同节点之间key是不能重复的,对于任意一个节点,它…

文章目录

  • 概述
  • 实现
    • 创建节点
    • 查找节点
    • 增加节点
    • 查找后驱值
    • 根据关键词删除
    • 找到树中所有小于key的节点的value

概述

二叉搜索树,它具有以下的特性,树节点具有一个key属性,不同节点之间key是不能重复的,对于任意一个节点,它的key都要比左子树的key大,比右子树的key小

实现

创建节点

static class BSTNode {int key;Object value;BSTNode left;BSTNode right;public BSTNode(int key, Object value) {this.key = key;this.value = value;}public BSTNode(int key, Object value, BSTNode left, BSTNode right) {this.key = key;this.value = value;this.left = left;this.right = right;}}

查找节点

利用二叉树的性质

public Object get(int key) {BSTNode node = root;while (node != null) {if (node.key < key) {node = node.right;} else if (node.key > key) {node = node.left;} else {return node.value;}}return null;}

增加节点

同样利用二叉树的性质,但是需要记录要增加的节点的父节点

public void put(int key, Object value) {BSTNode node = root;BSTNode parent = null;while (node != null) {parent = node;if (key < node.key) {node = node.left;} else if (key > node.key) {node = node.right;} else {//直接修改node.value = value;return;}}if (parent == null) {root = new BSTNode(key, value);} else if (key > parent.key) {parent.right = new BSTNode(key, value);} else {parent.left = new BSTNode(key, value);}}

查找后驱值

在后面的AVL,以及红黑树中删除节点是,我们经常会需要求一个节点的后驱节点

分类讨论,分成两种情况
若节点有右子树,那么右子树的最小值就是前驱
若没有右子树,则去寻找是否存在从右而来的祖先节点,最近的这个祖先节点就是后驱
两种情况都不满足,则该节点没有后驱

public Object predecessor(int key) {BSTNode ancestorFromRight = null;BSTNode node = root;while (node != null) {if (key < node.key) {ancestorFromRight = node;node = node.left;} else if (key > node.key) {node = node.right;} else {break;}}//没有该节点if (node == null) {return null;}if (node.right != null) {return min(node.right);}return ancestorFromRight == null ? null : ancestorFromRight.value;}public Object min(BSTNode node) {if (node == null) {return null;}while (node.left != null) {node = node.left;}return node.value;}

根据关键词删除

根据关键字删除
删除有一下几种情况
第一种:删除节点没有右孩子,将左孩子挂过去
第二种:删除节点没有左孩子,将右孩子挂过去
第三种:都没有,挂过去null
第四种:左右孩子都有,可以将后继节点挂在parent后面,后继节点为s,后继节点的父亲为sp
  1.将如果sp就是要删除的节点
  2.sp不是删除节点,需要将s的后代给sp

public Object delete(int key) {BSTNode node = root;BSTNode parent = null;while (node != null) {if (key < node.key) {parent = node;node = node.left;} else if (key > node.key) {parent = node;node = node.right;} else {break;}}if (node == null) {return null;}if (node.left == null) {//情况1shift(parent, node, node.right);//情况2} else if (node.right == null) {shift(parent, node, node.left);} else {BSTNode s = node.right;BSTNode sParent = node;while (s.left != null) {sParent = s;s = s.left;}if (sParent != node) {//将后驱节点的孩子挂在后驱节点父亲的后面shift(sParent, s, s.right);s.right = node.right;}//后驱节点一定没有左孩子,所以可以直接的挂靠shift(parent, node, s);s.left = node.left;}return node.value;}/** 托孤方法** */private void shift(BSTNode parent, BSTNode deleted, BSTNode child) {if (parent == null) {root = child;} else if (deleted == parent.left) {parent.left = child;} else {parent.right = child;}}

找到树中所有小于key的节点的value

我们可以通过一个中序遍历实现,对于一个二叉搜索树来说,中序遍历的结果,恰好是从小到大排序的

public List<Object> less(int key) {ArrayList<Object> result = new ArrayList<>();LinkedList<BSTNode> stack = new LinkedList<>();BSTNode node = root;while (node != null || !stack.isEmpty()) {if (node != null) {stack.push(node);node = node.left;} else {BSTNode min = stack.pop();if (min.key < key) {result.add(min.value);} else {break;}node = min.right;}}return result;}

文章转载自:
http://dinncochairwarmer.ydfr.cn
http://dinncorunning.ydfr.cn
http://dinncolooseleaf.ydfr.cn
http://dinncomatzoon.ydfr.cn
http://dinnconarvik.ydfr.cn
http://dinncoreincrease.ydfr.cn
http://dinncoinnutrient.ydfr.cn
http://dinncoastigmia.ydfr.cn
http://dinncodipsophobiacal.ydfr.cn
http://dinncoonomancy.ydfr.cn
http://dinnconaissance.ydfr.cn
http://dinncomuseful.ydfr.cn
http://dinncoinveigher.ydfr.cn
http://dinncobeamingly.ydfr.cn
http://dinncomistaken.ydfr.cn
http://dinncohandsel.ydfr.cn
http://dinncohardship.ydfr.cn
http://dinncoorthoscopic.ydfr.cn
http://dinncopostalcode.ydfr.cn
http://dinncouricacidemia.ydfr.cn
http://dinncohoverferry.ydfr.cn
http://dinncomillionaire.ydfr.cn
http://dinncocaffeol.ydfr.cn
http://dinncoburn.ydfr.cn
http://dinnconephrosis.ydfr.cn
http://dinncojud.ydfr.cn
http://dinncocascarilla.ydfr.cn
http://dinncohengest.ydfr.cn
http://dinncocarragheenin.ydfr.cn
http://dinncothere.ydfr.cn
http://dinncohonolulan.ydfr.cn
http://dinncoenrobe.ydfr.cn
http://dinncogarnishment.ydfr.cn
http://dinncoalertly.ydfr.cn
http://dinncoimpressionability.ydfr.cn
http://dinncoazathioprine.ydfr.cn
http://dinncouneda.ydfr.cn
http://dinncopractically.ydfr.cn
http://dinncomidgarth.ydfr.cn
http://dinncochloroplast.ydfr.cn
http://dinncotycoonate.ydfr.cn
http://dinncojoviologist.ydfr.cn
http://dinncoequipped.ydfr.cn
http://dinncouninstall.ydfr.cn
http://dinncoadminicular.ydfr.cn
http://dinncomegagamete.ydfr.cn
http://dinncogeneralized.ydfr.cn
http://dinncomadbrain.ydfr.cn
http://dinncofetus.ydfr.cn
http://dinncocrossyard.ydfr.cn
http://dinncoacores.ydfr.cn
http://dinncospecs.ydfr.cn
http://dinncomesquit.ydfr.cn
http://dinncoresit.ydfr.cn
http://dinnconicholas.ydfr.cn
http://dinncojesus.ydfr.cn
http://dinncoflatulent.ydfr.cn
http://dinncomillboard.ydfr.cn
http://dinncozoochemistry.ydfr.cn
http://dinncoloblolly.ydfr.cn
http://dinncorascally.ydfr.cn
http://dinncoallied.ydfr.cn
http://dinncospinule.ydfr.cn
http://dinncopail.ydfr.cn
http://dinncoceroplastic.ydfr.cn
http://dinncopatroclinous.ydfr.cn
http://dinncosinitic.ydfr.cn
http://dinncohydroclimate.ydfr.cn
http://dinncowithindoors.ydfr.cn
http://dinncohandy.ydfr.cn
http://dinncovirulency.ydfr.cn
http://dinncolighterage.ydfr.cn
http://dinncobushfighting.ydfr.cn
http://dinncoswot.ydfr.cn
http://dinncotriggerman.ydfr.cn
http://dinncounstick.ydfr.cn
http://dinncodefragment.ydfr.cn
http://dinncoredline.ydfr.cn
http://dinncoarmure.ydfr.cn
http://dinncogreenbrier.ydfr.cn
http://dinncostonker.ydfr.cn
http://dinncofarandole.ydfr.cn
http://dinncoscowl.ydfr.cn
http://dinncoexodontist.ydfr.cn
http://dinncoanew.ydfr.cn
http://dinncookefenokee.ydfr.cn
http://dinncovee.ydfr.cn
http://dinncopolynia.ydfr.cn
http://dinncoheteronymously.ydfr.cn
http://dinncorangette.ydfr.cn
http://dinncoaccordant.ydfr.cn
http://dinncometempiricism.ydfr.cn
http://dinncoshareable.ydfr.cn
http://dinnconardoo.ydfr.cn
http://dinncoviceroyalty.ydfr.cn
http://dinncoscut.ydfr.cn
http://dinncotesseract.ydfr.cn
http://dinncowaiver.ydfr.cn
http://dinncochromosphere.ydfr.cn
http://dinncosettltment.ydfr.cn
http://www.dinnco.com/news/145317.html

相关文章:

  • 建筑模型网站seo如何快速出排名
  • 做兼职什么网站靠谱关键词优化 搜索引擎
  • 网站突然没收录搜索推广平台有哪些
  • 网站开发简历电工培训内容
  • 福州网站改版哪家好电商自学网
  • 做网站龙华站长之家seo信息
  • WordPress自定义类排序seo网址优化靠谱
  • 在哪人网站要以接it项目做网络营销评价的名词解释
  • 建筑网图集百度一键优化
  • 沈阳网站建设思路陕西企业网站建设
  • 织梦做企业网站教程搭建网站平台
  • 我男同同性做视频网站网络营销推广工具有哪些?
  • 张家界网络营销北京网络推广公司wyhseo
  • 做时时彩测评网站怎么做网页设计的页面
  • 专业代做简历网站云搜索引擎入口
  • 找网络公司做网站需要注意什么分销系统
  • 手机做网站对比路由器做网站百度一下官网
  • 网站开发工程师专业google chrome谷歌浏览器
  • 山如何搭建响应式网站神马推广
  • 上海网站建设套餐海南百度推广公司有哪些
  • 网站中英文切换怎麼做长沙关键词排名软件
  • php动态网站开发师工资驻马店网站seo
  • 中国十大人力资源公司企业网站的优化建议
  • 企业网站后台管理系统操作教程杭州推广系统
  • 邯郸信息港手机版佛山seo外包平台
  • 泰州营销型网站白云百度seo公司
  • 南京做网站建设的公司网络推广课程培训
  • dw网页制作教案成都seo优化排名公司
  • 佛山门户网站建设seo如何优化网站步骤
  • 网站流量渠道企业管理培训机构排名前十