rising
BAN USER- 0of 0 votes
AnswersDesign a structure for a student record which has following 3 fields-
- rising in India
ID - integer value
Name - String
either a grade - which is float value OR rank - which is integer value.
Also write a function to print the details of a student record such that if the student is given grade it must be printed as float value but if he is given rank then it must be printed as integer value.| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer C - 0of 0 votes
AnswersWrite a function in C to efficiently copy 1 file to another.
- rising in India| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer C - 0of 0 votes
AnswersA node of a binary tree has two pointers left and right and two data fields- left count and right count. left count specifies the number of nodes in left of the node and right specifies the number of nodes in right of the node. Write an algorithm to populate the data fields of all the nodes of the tree.
- rising in India| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Data Structures
This is what solution I came up with:
void populate(NODE *root){
if (root == NULL)
return;
populate(root->left);
populate(root->right);
if(root->left)
root->lc = root->left->lc + root->left->rc + 1;
else
root->lc = 0;
if(root->right)
root->rc = root->right->lc + root->right->rc + 1;
else
root->rc = 0;
}
@Amol.. It's like this. Suppose the base is of length B. When it is divided into 5 parts all the parts will be equal to B/5. If we join all these 4 points which helped us divide base to 5 equal parts with the opposite vertex, the area of each triangle will be 0.5 * H *B/5.
- rising January 21, 2013