zoukankan      html  css  js  c++  java
  • [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


    
    
  • 相关阅读:
    IDF实验室-CTF训练营-牛刀小试CTF
    百度杯CTF夺旗大赛9月场writeup
    基于Mapxtreme for JAVA的电子地图设计与实现
    centos下 apache+mysql+php的安装
    ssh远程登陆
    毕业设计-JSP论文盲审系统
    Android毕业设计-微圈
    基于Android的高校饮水宝app
    小程序不支持wx.request同步请求解决方法
    微信小程序服务类目大坑:特殊行业服务类目所需资质材料
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看