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


    
    
  • 相关阅读:
    PHP用*号替代姓名除第一个字之外的字符
    苹果笔记本下载的应用打不开或提示损坏怎么办
    codeigniter教程:Codeigniter出现Unable to connect to your databas
    Python3.6.0安装
    某游戏应用的redis 数据库结构设计(转)
    True(False) Positives (Negatives), 召回率和精度定义
    儿童书库
    年轻人必须知道的71个做饭技巧
    20种泡菜做法[3到5天就可以吃了]
    读懂此文——股市就是你的取款机
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看