ozanokanavci
BAN USER
not sure but this might work.
int toBinarySearchTree (Node n) {
if ( n is leaf )
return n.val;
int leftChildVal= toBinarySearchTree(n.left);
int rightChildVal= toBinarySearchTree(n.right);
if (leftChildVal > n.val ) {
replace n node and n.left node
}
if ( n.val < rightChildVal ) {
replace n node and n.right node
}
}
- ozanokanavci April 03, 2010euclid s algorithm
int gcd ( int a, int b ) {
if ( b == 0 )
return a;
else return gcd ( b , a - b * ( a / b ) );
}
Repjacobghester2, Accountant at ASAPInfosystemsPvtLtd
I'm an artist at heart. I went from print design to web development and lots of server administration professionally ...
Repmariawharris2, Computer Scientist at Adjetter Media Network Pvt Ltd.
Hi I am an IT Project Management Professional with 2 years' experience,Handled project development and documentation of copier rentals ...
Repnancysimms14, Backend Developer at ASAPInfosystemsPvtLtd
I am Nancy from California,Handling project development and documentation is my job. Passionate determined.Looking for an open project ...
public int calculate(int num) {
- ozanokanavci April 18, 2010while (num > 10) {
int curr_num = num;
num=0;
while (curr_num > 0) {
num += curr_num % 10;
curr_num = curr_num /10;
}
}
return num;
}