[LintCode] Connecting Graph
Posted Push your limit!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LintCode] Connecting Graph相关的知识,希望对你有一定的参考价值。
Given n
nodes in a graph labeled from 1
to n
. There is no edges in the graph at beginning.
You need to support the following method:
1. connect(a, b)
, add an edge to connect node a
and node b. 2.
query(a, b)`, check if two nodes are connected
Example
5 // n = 5 query(1, 2) return false connect(1, 2) query(1, 3) return false connect(2, 4) query(1, 4) return true
以上是关于[LintCode] Connecting Graph的主要内容,如果未能解决你的问题,请参考以下文章
[LintCode] Connecting Graph II
MySQL 5.6主从Slave_IO_Running:Connecting/error connecting to master *- retry
从 Connecting 到 NotConnected 的 Multipeer Connectivity 会话
为啥 JS WebSocket 在 sparkjava 中会卡在 CONNECTING 上?