parameters: (self, elem1, elem2)
return_statement: return self.root(elem1) == self.root(elem2)
docstring: elem1 and elem2 are connected iff they have same root. It takes
          time proportional to depth of elem1 and elem2. Time complexity is lg(N)
  
          :param elem1: element 1
          :param elem2: element 2
          :return: returns true iff two elem1 and elem2  are connected, else
              false
          :rtype: bool
docstring_summary: elem1 and elem2 are connected iff they have same root. It takes
          time proportional to depth of elem1 and elem2. Time complexity is lg(N)
docstring_tokens: elem1 and elem2 are connected iff they have same root . It takes time proportional to depth of elem1 and elem2 . Time complexity is lg ( N )
function: def connected(self, elem1, elem2):
          """ elem1 and elem2 are connected iff they have same root. It takes
          time proportional to depth of elem1 and elem2. Time complexity is lg(N)
  
          :param elem1: element 1
          :param elem2: element 2
          :return: returns true iff two elem1 and elem2  are connected, else
              false
          :rtype: bool
          """
          return self.root(elem1) == self.root(elem2)
function_tokens: def connected ( self , elem1 , elem2 ) : return self . root ( elem1 ) == self . root ( elem2 )