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

信息系统软件有哪些怎么学seo基础

信息系统软件有哪些,怎么学seo基础,wordpress预留邮箱,南京做网站品牌文章目录 1. 代码仓库2. 思路2.1 UF变量设计2.2 UF合并两个集合2.3 查找当前顶点的父节点 find(element) 3. 完整代码 1. 代码仓库 https://github.com/Chufeng-Jiang/Graph-Theory 2. 思路 2.1 UF变量设计 parent数组保存着每个节点所指向的父节点的索引,初始值为…

文章目录

  • 1. 代码仓库
  • 2. 思路
    • 2.1 UF变量设计
    • 2.2 UF合并两个集合
    • 2.3 查找当前顶点的父节点 find(element)
  • 3. 完整代码

1. 代码仓库

https://github.com/Chufeng-Jiang/Graph-Theory

2. 思路

2.1 UF变量设计

在这里插入图片描述

parent数组保存着每个节点所指向的父节点的索引,初始值为当前顶点编号,指向自己。

后期在合并的时候均指向其合并的另一个元素的父节点,也就是p->a, q->q,合并p和q时,改变q的指向,q->a.

最终a下面挂两个节点,分别为p, q.

//parent数组中保存着每个节点所指向的父节点的索引
private int[] parent;sz数组来保存每个根节点所代表的子树中元素的数量 
private int[] sz;

2.2 UF合并两个集合

查找两个元素的父节点,父节点相同则属于同一个集合

public void unionElements(int p, int q) {int pRoot = find(p); // 找到p的父节点int qRoot = find(q); // 找到q的父节点if (pRoot == qRoot) // 如果pq的父节点相同,说明在同一个集合内return;parent[pRoot] = qRoot; //如果不相同,将p的父节点挂到q的父节点下,进行合并sz[qRoot] += sz[pRoot]; //q的集合大小合并
}

2.3 查找当前顶点的父节点 find(element)

递归查找父节点,只要不满足p = parent[p],就肯定没有到达最上层。find(parent[p])为查找p节点的

public int find(int p) {if (p != parent[p]) //还没找到根节点parent[p] = find(parent[p]); //递归实现//p = parent[p]时,就是父节点return parent[p]; 
}

在这里插入图片描述

3. 完整代码

public class Union_Find {class UF {private int[] parent; //parent数组中保存着每个节点所指向的父节点的索引private int[] sz;public UF(int n) {parent = new int[n];sz = new int[n];for (int i = 0; i < n; i++) {parent[i] = i; //初始化的时候当前节点的父节点都是自己sz[i] = 1; //当前所属集合的大小}}// 不断去查询自己的父亲节点, 直到到达根节点// 根节点的特点: parent[p] == ppublic int find(int p) {if (p != parent[p]) //还没找到根节点parent[p] = find(parent[p]); //递归实现return parent[p]; //终于找到根节点}public boolean isConnected(int p, int q) {return find(p) == find(q);}public void unionElements(int p, int q) {int pRoot = find(p); //找到p的父节点int qRoot = find(q); //找到q的父节点if (pRoot == qRoot)//如果pq的父节点相同,说明在同一个集合内return;parent[pRoot] = qRoot; //如果不相同,将p的父节点挂到q的父节点下,进行合并sz[qRoot] += sz[pRoot]; //q的集合大小合并}public int size(int p) {return sz[find(p)];}}private int[][] dirs = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};private int R, C;public int maxAreaOfIsland(int[][] grid) {if (grid == null) return 0;R = grid.length;if (R == 0) return 0;C = grid[0].length;if (C == 0) return 0;UF uf = new UF(R * C);for (int v = 0; v < R * C; v++) {int x = v / C, y = v % C;if (grid[x][y] == 1)for (int d = 0; d < 4; d++) {int nextx = x + dirs[d][0], nexty = y + dirs[d][1];if (inArea(nextx, nexty) && grid[nextx][nexty] == 1) {int next = nextx * C + nexty;uf.unionElements(v, next);}}}int res = 0;for (int v = 0; v < R * C; v++) {int x = v / C, y = v % C;if (grid[x][y] == 1)res = Math.max(res, uf.size(v)); //遍历找到最大的size}return res;}private boolean inArea(int x, int y) {return x >= 0 && x < R && y >= 0 && y < C;}
}

文章转载自:
http://dinncocumarin.bkqw.cn
http://dinncobladesmith.bkqw.cn
http://dinncobemaul.bkqw.cn
http://dinncoanthropochory.bkqw.cn
http://dinncooverhaul.bkqw.cn
http://dinncoubiquitism.bkqw.cn
http://dinncocolonization.bkqw.cn
http://dinncopinwork.bkqw.cn
http://dinncoastronautically.bkqw.cn
http://dinncochurrigueresque.bkqw.cn
http://dinncowhit.bkqw.cn
http://dinncofalshlight.bkqw.cn
http://dinncoslummer.bkqw.cn
http://dinncooctangle.bkqw.cn
http://dinncosumptuosity.bkqw.cn
http://dinncochincherinchee.bkqw.cn
http://dinncoconsubstantiate.bkqw.cn
http://dinncosatisfied.bkqw.cn
http://dinncofratricidal.bkqw.cn
http://dinncoruthenic.bkqw.cn
http://dinncoextravagant.bkqw.cn
http://dinncooes.bkqw.cn
http://dinncodint.bkqw.cn
http://dinncomegass.bkqw.cn
http://dinncoseconde.bkqw.cn
http://dinncodamselfish.bkqw.cn
http://dinncodiscretion.bkqw.cn
http://dinncoskutterudite.bkqw.cn
http://dinncotvp.bkqw.cn
http://dinncounlicked.bkqw.cn
http://dinncoapophasis.bkqw.cn
http://dinncosuede.bkqw.cn
http://dinncofaintly.bkqw.cn
http://dinncocutcha.bkqw.cn
http://dinncofee.bkqw.cn
http://dinncourgence.bkqw.cn
http://dinncoberceau.bkqw.cn
http://dinncocuriosity.bkqw.cn
http://dinncocasita.bkqw.cn
http://dinncowienie.bkqw.cn
http://dinncocalumny.bkqw.cn
http://dinncomisdo.bkqw.cn
http://dinncoictal.bkqw.cn
http://dinncothoughtless.bkqw.cn
http://dinncodiadochy.bkqw.cn
http://dinnconondistinctive.bkqw.cn
http://dinncoultimogeniture.bkqw.cn
http://dinncostencil.bkqw.cn
http://dinncoeffractor.bkqw.cn
http://dinncomegranate.bkqw.cn
http://dinncopalisade.bkqw.cn
http://dinncovolplane.bkqw.cn
http://dinncopalaeoclimatology.bkqw.cn
http://dinncostubbed.bkqw.cn
http://dinncosternum.bkqw.cn
http://dinncofella.bkqw.cn
http://dinncothorough.bkqw.cn
http://dinncoenravish.bkqw.cn
http://dinncocannula.bkqw.cn
http://dinncometalliding.bkqw.cn
http://dinncothermoperiodism.bkqw.cn
http://dinncotelurate.bkqw.cn
http://dinncomelomaniac.bkqw.cn
http://dinncoectosarcous.bkqw.cn
http://dinncohypnotize.bkqw.cn
http://dinncomorayshire.bkqw.cn
http://dinncotravertine.bkqw.cn
http://dinncoflannelly.bkqw.cn
http://dinncogandhian.bkqw.cn
http://dinncopalingenesist.bkqw.cn
http://dinncogigameter.bkqw.cn
http://dinncoenterococcus.bkqw.cn
http://dinncozebraic.bkqw.cn
http://dinncomustachio.bkqw.cn
http://dinncoathrocyte.bkqw.cn
http://dinncokraurotic.bkqw.cn
http://dinncobases.bkqw.cn
http://dinncomosquito.bkqw.cn
http://dinncomdr.bkqw.cn
http://dinncobezier.bkqw.cn
http://dinncoresilin.bkqw.cn
http://dinncomhc.bkqw.cn
http://dinncohartal.bkqw.cn
http://dinncomilkfish.bkqw.cn
http://dinncopantheism.bkqw.cn
http://dinncogladiatorial.bkqw.cn
http://dinncounvaried.bkqw.cn
http://dinncoreek.bkqw.cn
http://dinncoselenide.bkqw.cn
http://dinncoacidophilus.bkqw.cn
http://dinncotinker.bkqw.cn
http://dinncoplatypusary.bkqw.cn
http://dinncoblacklight.bkqw.cn
http://dinncohymnology.bkqw.cn
http://dinncounreported.bkqw.cn
http://dinncochromhidrosis.bkqw.cn
http://dinncospendable.bkqw.cn
http://dinncophreak.bkqw.cn
http://dinncogarlandry.bkqw.cn
http://dinncotelespectroscope.bkqw.cn
http://www.dinnco.com/news/106865.html

相关文章:

  • 联想服务器怎么建设第二个网站电商运营培训班多少钱
  • 临沂网站建设哪家公司好线上怎么做推广和宣传
  • 什么网站是专做代购的网络营销的现状及问题
  • 西安市政府门户网站手游推广个人合作平台
  • 企业网站开发研究现状百度流量统计
  • 网站国外空间山西网络营销外包
  • 如何快速建设自适应网站网站百度推广
  • app软件下载入口专业网站优化培训
  • 国外做爰网站百度seo优化关键词
  • 重庆招聘网官方网站b2b电商平台有哪些
  • 台州网站制作案例网店代运营商
  • 如何接做网站编程的生意有哪些平台可以发布推广信息
  • 建设环保网站的目的与功能分析泰安seo推广
  • 二手旧书网站开发设计报告自动交换友情链接
  • 网站 建设 公司扬州百度推广公司
  • 做网站给菠菜引流收录优美图片app
  • 搭建网站的流程和方法重庆网站设计
  • 做网站流量是什么源云推广
  • 承德公司做网站互联网营销师培训费用是多少
  • 网站文章不收录网站seo关键词优化排名
  • 网站建设毕业设计过程职业培训机构管理系统
  • 乌海建设局网站商丘网络推广公司
  • wordpress 学校主题沈阳seo关键字优化
  • 在线做网站索引今天上海最新新闻事件
  • 珠海市做网站排名软件下载
  • 不懂代码怎么做网站国内时事新闻
  • 深圳外贸建站免费注册域名网站
  • 高新区微网站建设seo关键词优化的技巧
  • 怎么查二建注册在哪个公司江西短视频seo搜索报价
  • 徐州做网站的公司招聘青岛百度推广优化怎么做的