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


    
    
  • 相关阅读:
    mongoDB 小练习
    pymongo 操作
    mongoDB 大文件存储方案, JS 支持展示
    mongoDB 固定集合
    mongoDB 聚合操作
    mongoDB 索引
    mongoDB 其他数据类型
    mongoDB 文档操作_删
    mongoDB 文档操作_改
    【探讨】linux环境,执行重启了php后php.ini依然不生效
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看