Comments (1)
动态联通图问题,需要将问题抽象成一个可编程的过程。书中提到触点、分量和连接,所以编程第一步,先初始化触点信息,简洁期间,每个触点信息保持跟他们的序号一样就行了。
union find
,大致意思就是将所有联通的节点信息归并为一个,有点类似于物理电路中的电势,让各点电势一样;quick union
,将联通的两点按照顺序连接起来,有点像指针,a->b->c->d,保持串联,每次新的连接,都去判断两点的根指针是否一致,如果一致则略过,如果不一致则连接;weighted quick union
,在上面算法的基础上,添加了权重判断,每个节点除了序号信息外,还有一个数深度信息(size),当指针不一致需要连接时,将深度小的数合并到大的上面(我觉得这一步有点难理解)。
研究算法的实现还是挺有意思的,最难的地方莫过于对复杂度的计算和判断。
from algorithms.
Related Issues (17)
- BinarySearch HOT 3
- Quick sort and improvement
- Quick sort improvement for which contains lots of duplicate data.
- Priority Queues, Heap Sort
- Thoughts(一些遐思), update continuously HOT 4
- algorirhms HOT 1
- Data Generator
- [每日一题] Two Sum HOT 3
- Sequential Search
- Binary Search
- Dijkstra double stack HOT 1
- Algorithms Analysis
- Three basic Sort Algorithms HOT 1
- Algorithms Visualizer HOT 3
- Shell Sort
- Merge Sort
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algorithms.