raghuram


{ City } bangalore
< Country > india
* Profession *
User No # 6167
Total Questions Posted # 0
Total Answers Posted # 16

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 287
Users Marked my Answers as Wrong # 161
Answers / { raghuram }

Question { 6694 }

Write a program that find and print how many odd numbers in
a binary tree


Answer

struct node
{
int data;
struct node *l;
struct node *r;
};
typedef struct node *n;
int oddnos(n root)
{
static int count;
n cur = root;
if(cur!=NULL)
{
if(cur->data%2==1)
count++;
oddnos(root->l);
oddnos(root->r);
}
return count;
}

Is This Answer Correct ?    8 Yes 5 No



Prev    1    [2]