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


    
    
  • 相关阅读:
    当公有云Azure拥抱Docker容器技术
    .NET AJAX实例
    漫谈Ajax在.Net中的使用
    .NET运用AJAX 总结及其实例
    Excel自动从身份证中提取生日、性别、年龄
    ASP.NET 与 Ajax 的实现方式
    windows下编辑器Emacs的安装与配置
    2013.10.26工作Fighting(1)
    Jquery操作下拉框(DropDownList)实现取值赋值
    js调用后台,后台调用前台等方法总结
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看