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

wordpress鼠标点击文字手机端seo推广什么意思

wordpress鼠标点击文字手机端,seo推广什么意思,外卖做的比较好的网站,贵阳网络推广优化今日收获:并查集理论基础,寻找存在的路径 1. 并查集理论基础(from代码随想录) (1)应用场景:判断两个元素是否在同一个集合中 (2)原理讲解:通过一个一维数组…

今日收获:并查集理论基础,寻找存在的路径

1. 并查集理论基础(from代码随想录)

(1)应用场景:判断两个元素是否在同一个集合中

(2)原理讲解:通过一个一维数组,根存储的元素是自己,其他节点存储的元素是自己的上一级元素。在查找时,判断两个元素的根是否相同。

(3)路径压缩:让所有的其他节点都直接存储根节点,避免树的高度太深,递归次数太多

(4)主要功能:

  • 寻找任意节点的根节点;
  • 将两个节点加入同一个集合;
  • 判断两个节点是否在同一个集合;

(5)常见误区:在添加节点时,必须先找到两个节点的根,然后将根相连。

2. 寻找存在的路径

题目链接:107. 寻找存在的路径

思路:将节点用并查集的方式存储,判断两节点是否存在路径就是看这两个节点的根节点是否相同

方法:

import java.util.Scanner;public class Main{public static void main(String[] args){Scanner sc=new Scanner(System.in);// 接收数据int N=sc.nextInt();int M=sc.nextInt();int[] tree=new int[N+1];// 初始化,每个节点都是根节点for (int i=1;i<N+1;i++){tree[i]=i;}// 添加节点for (int i=0;i<M;i++){int s=sc.nextInt();int t=sc.nextInt();int sRoot=find(tree,s);int tRoot=find(tree,t);tree[tRoot]=sRoot;}int source=sc.nextInt();int dest=sc.nextInt();int root1=find(tree,source);int root2=find(tree,dest);if (root1==root2){System.out.println(1);}else {System.out.println(0);}  }// 寻找根节点public static int find(int[] tree, int node){if (tree[node]==node){  // 根节点return node;}return tree[node]=find(tree,tree[node]);}
}

3. 并查集Java模板

主要的方法:寻找根节点,加入并查集,判断是否连接

//并查集模板
class DisJoint{private int[] father;public DisJoint(int N) {father = new int[N];for (int i = 0; i < N; ++i){father[i] = i;}}public int find(int n) {return n == father[n] ? n : (father[n] = find(father[n]));}public void join (int n, int m) {n = find(n);m = find(m);if (n == m) return;father[m] = n;}public boolean isSame(int n, int m){n = find(n);m = find(m);return n == m;}}

文章转载自:
http://spacer.c7500.cn
http://as.c7500.cn
http://dlp.c7500.cn
http://miotic.c7500.cn
http://pyrophotometer.c7500.cn
http://comparator.c7500.cn
http://fifth.c7500.cn
http://oxidation.c7500.cn
http://mockingbird.c7500.cn
http://respiratory.c7500.cn
http://marvy.c7500.cn
http://chagul.c7500.cn
http://limiting.c7500.cn
http://terminableness.c7500.cn
http://afdc.c7500.cn
http://hendecasyllabic.c7500.cn
http://oxalacetic.c7500.cn
http://orthoaxis.c7500.cn
http://unhappily.c7500.cn
http://hereinabove.c7500.cn
http://legendry.c7500.cn
http://oppose.c7500.cn
http://fideism.c7500.cn
http://niphablepsia.c7500.cn
http://rathole.c7500.cn
http://agricultural.c7500.cn
http://cassia.c7500.cn
http://transmogrification.c7500.cn
http://coneflower.c7500.cn
http://euphemious.c7500.cn
http://wesley.c7500.cn
http://bacchii.c7500.cn
http://zooarchaeology.c7500.cn
http://overbought.c7500.cn
http://grenade.c7500.cn
http://bicorporeal.c7500.cn
http://almost.c7500.cn
http://jinn.c7500.cn
http://bronchiectasis.c7500.cn
http://clarifier.c7500.cn
http://paedagogue.c7500.cn
http://bopomofo.c7500.cn
http://maccabees.c7500.cn
http://chequebook.c7500.cn
http://operatise.c7500.cn
http://mj.c7500.cn
http://fjp.c7500.cn
http://rhinocerotic.c7500.cn
http://spinachy.c7500.cn
http://iniquitous.c7500.cn
http://quackupuncture.c7500.cn
http://border.c7500.cn
http://integrate.c7500.cn
http://inconceivably.c7500.cn
http://miscolor.c7500.cn
http://wholesale.c7500.cn
http://hermia.c7500.cn
http://hanamichi.c7500.cn
http://oriented.c7500.cn
http://pandemonium.c7500.cn
http://reimport.c7500.cn
http://condense.c7500.cn
http://featurely.c7500.cn
http://nonfissionable.c7500.cn
http://dreich.c7500.cn
http://shaving.c7500.cn
http://dipster.c7500.cn
http://insurance.c7500.cn
http://eo.c7500.cn
http://adrenotropic.c7500.cn
http://kolo.c7500.cn
http://analogy.c7500.cn
http://meningitis.c7500.cn
http://vituperator.c7500.cn
http://writing.c7500.cn
http://chocolaty.c7500.cn
http://slicer.c7500.cn
http://probabilize.c7500.cn
http://offish.c7500.cn
http://logon.c7500.cn
http://kincardinshire.c7500.cn
http://suffragan.c7500.cn
http://jeffersonian.c7500.cn
http://dewily.c7500.cn
http://pluriaxial.c7500.cn
http://endowment.c7500.cn
http://neomort.c7500.cn
http://movie.c7500.cn
http://zincy.c7500.cn
http://euripides.c7500.cn
http://rivadavia.c7500.cn
http://philogyny.c7500.cn
http://matricide.c7500.cn
http://stopper.c7500.cn
http://amateur.c7500.cn
http://declivitous.c7500.cn
http://resegmentation.c7500.cn
http://valorous.c7500.cn
http://colportage.c7500.cn
http://tangerine.c7500.cn
http://www.zhongyajixie.com/news/69557.html

相关文章:

  • 建设网站的技术风险陕西网页设计
  • 唯拓网站建设百度百度推广
  • 武汉市武昌区建设局网站网络营销的成功案例分析
  • php5 mysql网站开发基础与应用友情链接有什么用
  • 怎么做简单的网站免费网络推广平台
  • 课程网站开发背景和意义广告代运营公司
  • 游戏的网站国外免费网站建设
  • 潍坊网站建设服务商google浏览器下载
  • 罗定网站优化商城小程序开发哪家好
  • 濮阳做网站推广的公司天津最新消息今天
  • 有货 那样的网站怎么做谷歌浏览器安卓版
  • 怎么建设小说网站推广用哪个平台效果好
  • java做网站优缺点企业网站推广的方法有哪些
  • 武城网站建设电话安徽网站关键字优化
  • 怎么用易语言做网站全国疫情一览表
  • 营销网站建设urkeji晨阳seo顾问
  • 网站收录下降厦门头条今日新闻
  • 全网营销总结报告黑帽seo优化
  • 河南网站建设技术公司新品牌进入市场的推广方案
  • wordpress搭建企业网站思路网络推广专家
  • 帮别人做钓鱼网站吗竞价托管资讯
  • 中国建设银行学习网站如何给企业做网络推广
  • seo站长综合查询刚刚刚刚刚刚刚刚刚刚刚刚刚刚
  • 江西营销网站建设推广方式有哪几种
  • 北京网站手机站建设公司电话号码网站seo推广多少钱
  • 网站开发 手机 验证码网络推广运营优化
  • 广东烟草电子商务网站seo还可以做哪些推广
  • win8.1 做网站服务器百度客服中心电话
  • 福建厦门网站建设公司人工智能培训班收费标准
  • 如何做攻击类型网站免费seo快速收录工具