Go Recursive and Iterative
Recursive:\n\nfunc connect(root *Node) *Node {\n    if root == nil {\n        return nil\n    }\n    \n    if root.Left != nil {\n        root.Left.Next = root.
Recursive:\n```\nfunc connect(root *Node) *Node {\n    if root == nil {\n        return nil\n    }\n    \n    if root.Left != nil {\n        root.Left.Next = root.Right\n        if root.Next != nil {\n            root.Right.Next = root.Next.Left\n        }\n    }\n    \n    connect(root.Left)\n    connect(root.Right)\n    \n    return root\n}\n```\n\nIterative (BFS with Queue):\n```\nfunc connect(root *Node) *Node {\n    if root == nil {\n        return nil\n    }\n    \n    type entry struct{\n        level int\n        node *Node\n    }\n    \n    var queue []entry\n    \n    var prev *Node\n    currLevel := -1\n    \n    queue = append(queue, entry{level: 0, node: root})\n    \n    for len(queue) != 0 {\n        curr := queue[0]\n        queue = queue[1:]\n        \n        if currLevel != curr.level {\n            if prev != nil {\n                prev.Next = nil\n            }\n            currLevel = curr.level\n        } else {\n            prev.Next = curr.node\n        }\n        \n        prev = curr.node\n        \n        if curr.node.Left != nil {\n            queue = append(queue, entry{level: curr.level+1, node: curr.node.Left})\n        }\n        \n        if curr.node.Right != nil {\n            queue = append(queue, entry{level: curr.level+1, node: curr.node.Right})\n        }\n    }\n    \n    return root\n}\n```
['Go']