Advertisement
Guest User

Untitled

a guest
May 28th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         function getNodeHeight(node) {
  2.             if (node.hosts.size() === 0) {
  3.                 return 0;
  4.             }
  5.  
  6.             var heights = node.hosts.array.map(getNodeHeight);
  7.             var max = 0;
  8.             heights.forEach(function (height) {
  9.                 if (height > max) {
  10.                     max = height;
  11.                 }
  12.             });
  13.             return max + 1;
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement