Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
def con(Node n, int l, Node p) { if (n == null) return; l++; if (l == LEVEL) { if (p == null) p = n; else p.next = n; } p = con(n.left, l++, p); p = con(n.right, l++, p); return p;}
def con(Node n, int l, Node p) {
ReplyDeleteif (n == null) return;
l++;
if (l == LEVEL) {
if (p == null) p = n;
else p.next = n;
}
p = con(n.left, l++, p);
p = con(n.right, l++, p);
return p;
}