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


    
    
  • 相关阅读:
    [Hibernate]
    asc.desc
    Could not obtain connection metadata
    java枚举类Enum方法简介(valueof,value,ordinal)
    maven3 手动安装本地jar到仓库
    maven命令大全
    如何正确遍历删除List中的元素,你会吗?
    Hibernate的session.createSQLQuery的几种查询方式
    Linux-github 搭建静态博客
    我所写的CNN框架 VS caffe
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看