Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Wow, This is a simple and good algorithm :) is just that I want to knew the level of each node because I want to do a function that checks if the binary tree is balanced, using the property that for each node n in the tree their 2 subtrees have difereence in depth of 0 or 1. @AronAhmadia: How I can use the algorithm by Bernardo to implement this??
but this works for Binary Search Trees?? What happen if a node has no childs?? why return + 1 ?? (Sorry for all tihs questions, is just that I am new with binary Search trees and recursion)
I know what r u saying, but, I dont have access to an Array because then I have to do Send and Receive messages, which means that I will have more Overhead (that is not the idea). I think that an implementation on the Sieve of Erasthostenes will be grat, but I dont know how to translate the algorithm in code...
hi, thanks for the info of the loop for. the i = 3 sounds good! About testing the sqrt(n), how I test agains the primes smaller than sqrt(n)? I mean, how I can get this primes numbers??