claudiopro / binary-tree-neighbors

:evergreen_tree: Label nodes of a binary tree with nearest right-hand neighbor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

binary-tree-neighbors

Label nodes of a binary tree with nearest right-hand neighbor

Given a structure like the following:

         O
        / \
       O   O
      /   / \
     O   O   O
    /       / \
   O       O   O
  / \
 O   O

The program will label the tree with the nearest right-hand neighbor as follows:

         O-->null
        / \
       O-->O-->null
      /   / \
     O-->O-->O-->null
    /       / \
   O------>O-->O-->null
  / \
 O-->O-->null

License

MIT

Copyright (c) 2015 Claudio Procida

About

:evergreen_tree: Label nodes of a binary tree with nearest right-hand neighbor


Languages

Language:JavaScript 100.0%