第一章 Union-Find

01 Dynamic connectivity (动态连接性问题即 the model of union find 并查集模型)

问题:

a set of N objects (use the numbers zero through N-1 to model our objects). and we then have the idea of a connection between two objects. And, we'll, postulate that there's going to be a command that says, connect two objects. Given two objects, provide a connection between them. And then key part of the problem is find query or the connected query, which just asks, is there a path connecting the two objects. so for example

有N个对象(用数字0到N-1去标记这N个对象) 两个对象是可以连通的。我们假设有一个命令可以连接两个对象,将两个对象传入该命令将创造两者之间的连接,现在问题的关键是连通性的查询,即查询两个对象之间是否有联通的路径存在。举例:

in this set of ten objects, a bunch of union commands, connecting 4 and 3, 3 and 8, 6 and 5, 9 and 4, 2 and 1. And now we might have a connected query that says, is zero connected to seven? in this case, there is no connection, so we say no. But if we ask is eight connected to nine? We are going to say yes, even no we don't have a direct connection between eight and nine. There is a path from eight to three to four to nine. So, that's our problem, to be able to officially support these two commands for given set of objects.

So that's our problem, intermix union, commands and connected queries and we need to be able to officially support
those commands for a large number of objects.

更大一点的问题举例

Applications involve manipulating objects of all types.

we'll just name the objects with a number, integers from zero to N-1. That's a very convenient initial starting point for our programs because we can use integers as an index into an array then, and then quickly access information relevant to each object. And it also just supresses a lot of details that are not relevant to union find. In fact, to make this mapping from an object name to the integer zero through N - one is to find application of a symbol table or a searching algorithm. (用0到N-1标记这N个对象的好处)

关于连接的性质假定

自连接性:p is connected to p

对称性:if p is connected to q, then q is connected to p.

传递性: if p is connected to q and q is connected to r, then p is connected to r.

When we have an equivalence relation a set of objects and connections divide into subsets called connected components. A connected component is a maximal set of objects that's mutually connected. For example

未完待续...

普林斯顿大学算法公开课笔记相关推荐

  1. 数据挖掘-理论与算法 公开课笔记

    数据挖掘-理论与算法 公开课笔记 制作:纪元 本提纲遵循CC-BY-NC-SA协议 (署名-非商业性-相同方式共享) 最近更新时间:2020年3月4日01:48:00 文章目录 10.2.1.1 Da ...

  2. 斯坦福大学CS106A公开课笔记--启示环境配置

    首先感谢斯坦福大学所提供这么一个良好的平台,感谢主讲: Mehran Sahami.感谢奋战在翻译第一线的人人影视的高手们. 本文在线视频资料来源于:网易公开课 离线视频资料来源于:人人影视 1.ec ...

  3. 左程云算法 - 公开课笔记

    第五节 题目:原地交换,不允许额外的空间 方法1:复杂度O(N/2) 1.左侧逆序 2.右侧逆序 3.整体逆序 方法2:循环右移 复杂度O(N^2) 方法3: 直到左右等长的时候,就不再交换了 第六节 ...

  4. Coursera公开课笔记: 斯坦福大学机器学习第七课“正则化(Regularization)”

     Coursera公开课笔记: 斯坦福大学机器学习第七课"正则化(Regularization)" +13投票 斯坦福大学机器学习第七课"正则化"学习笔记, ...

  5. Coursera公开课笔记: 斯坦福大学机器学习第十一课“机器学习系统设计(Machine learning system design)”

    Coursera公开课笔记: 斯坦福大学机器学习第十一课"机器学习系统设计(Machine learning system design)" 斯坦福大学机器学习斯坦福大学机器学习第 ...

  6. Coursera公开课笔记: 斯坦福大学机器学习第六课“逻辑回归(Logistic Regression)”

    Coursera公开课笔记: 斯坦福大学机器学习第六课"逻辑回归(Logistic Regression)" 斯坦福大学机器学习第六课"逻辑回归"学习笔记,本次 ...

  7. Coursera公开课笔记: 斯坦福大学机器学习第一课“引言(Introduction)”

    Coursera公开课笔记: 斯坦福大学机器学习第一课"引言(Introduction)" 注:这是我在"我爱公开课"上做的学习笔记,会在52opencours ...

  8. Coursera公开课笔记: 斯坦福大学机器学习第四课“多变量线性回归(Linear Regression with Multiple Variables)”

    Coursera公开课笔记: 斯坦福大学机器学习第四课"多变量线性回归(Linear Regression with Multiple Variables)" 斯坦福大学机器学习第 ...

  9. Coursera公开课笔记: 斯坦福大学机器学习第二课“单变量线性回归(Linear regression with one variable)”

    Coursera公开课笔记: 斯坦福大学机器学习第二课"单变量线性回归(Linear regression with one variable)" 发表于 2012年05月6号 由 ...

最新文章

  1. 人工智能之机器学习算法体系汇总
  2. python——数据类型
  3. WebGL之物体选择
  4. Sentinel 1.7.2 发布,完善开源生态及扩展性
  5. css h5移动端背景铺满
  6. 编程语言那么多,学哪个能拿高薪?
  7. 苹果Mac Finder 替代工具:Path Finder
  8. 乔布斯一生中的3次阴差阳错、柳暗花明
  9. matlab最大回撤值,用matlab计算区间最大回撤值和最大回撤率
  10. 使用gb2312乱码,utf-8正常
  11. “打工人”梗刷爆网络,今天你打工了吗?
  12. 如何TIA博途中更新HSP硬件目录?
  13. cannot find -lxxx
  14. 学渣的刷题之旅 leetcode刷题 100.相同的树
  15. Hadoop02---HDFS基础(HDFS原理 java客户端).md
  16. python谷歌地图查找附近地铁站_Google地图实现查找指定地点1公里范围之内的地铁站...
  17. 计算机网络设计校园网实验报告,计算机网络课程设计实验报告---校园网网络构建方案设计和实现...
  18. 7-8 等腰直角三角形 -- PTA
  19. MAC IP地址扫描监控
  20. 自己尝试使用JSP实现医院病历管理系统

热门文章

  1. Luogu P3346 [ZJOI2015]诸神眷顾的幻想乡 广义SAM 后缀自动机
  2. Zabbix基于Dell系统管理OMSA监控物理服务器硬件
  3. ubuntu20.4安装谷歌
  4. TheFourthJavaText
  5. 友盟的Common的包下载失败,报错Forbidden
  6. android 语音发短信,谷歌Android增加语音操作功能 可语音发短信
  7. 腾讯云-即时通信 IM uni-app 和 java 整合过程
  8. 【新人入门】HTML——前端纯小白新手入门
  9. java picked up,抑制“Picked up _JAVA_OPTIONS”信息
  10. MapReduce重点知识