Answer:
bool identicaltrees(Node* root1,Node* root2)//function of type boolean true if idenctical false if not.
{
if(root1==NULL&&root2==NULL)//both trees are null means identical.
return true;
if(roo1 && root2)
{
if(root1->data==root2->data)//condition for recursive call..
{
return (identicaltrees(root1->left,root2->right)&&identicaltrees(root1->right&&root2->right);
}
}
else
return false;
}
Explanation:
In this function it of type boolean returns true if both the trees are identical return false if not.First we are checking root node of both the trees if both are null then they are identical returning true.
If both root nodes are not null then checking their data.If data is same then recursively traversing on both trees and checking both trees.
else returning false.
Answer:
The answer to this question can be described as follows:
Explanation:
Relational data model:
The use of data tables to organize sets of entities into relationships requires a relational data model. this model work on the assumption, which is a primary key or code, that is included in each table configuration. The symbol for "relational" data links and information is used by other tables.
Model Design:
This model is used for database management, it consists of structure and language consistency. It is design in 1969.
Importance of data model:
This provides a common standard for processing the potentially sound data in machines, that was usable on almost any one device.
Big Data:
It moves to locate new and innovative ways to handle large volumes of authentication tokens and to gather business insights when offering high efficiency and usability at an affordable cost at the same time.
Answer:
This is the complete correct program:
#include <stdio.h>
#include<sys/types.h>
#include<unistd.h>
int value = 128;
int main()
{
pid_t pid;
pid=fork();
if (pid==0) /* child process */
{
value +=8;
return 0; }
else if (pid > 0) {/* parent process */
wait (NULL);
printf ("PARENT: value =%d\n" ,value); /* LINEA */
return 0;
}
}
The output of the LINE A is:
PARENT: value = 128
Explanation:
The fork() function used in the program creates a new process and this process is the child process. The child process is same as the original process having its own address space or memory.
In the child process the value of pid is 0. So the if condition checks if pid==0. Then the child process adds 8 to the value of its variable according to the following statement
value +=8;
Now the original process has value = 128. In else if part the parents process has the value of pid greater than zero and this portion of the program is of the parent process :
else if (pid > 0)
{ wait (NULL);
printf ("PARENT: value =%d\n" ,value);
return 0; }
So the value 128 is printed at the end in the output.
wait(NULL) is used to wait for the child process to terminate so the parent process waits untill child process completes.
So the conclusion is that even if the value of the variable pid is changed in the child process but it will not affect the value in the variable of the parent process.
Answer:
a=4 , b=1
Explanation:
I'm not a computer science major at all but I think I can help you with this code.
Our program wants us to add 2 to a get new a value while also subtracting 1 from b value to obtain new b value. We we want to for for as long b is not 0 and a/b is nonnegative.
One round we get:
New a=0+2=2
New b=3-1=2
Let's see if we can go another round:
New a=2+2=4
New b=2-1=1
We can't go another round because b would be negative while a is positive which would make a/b negative. So our loop stops at this 2nd round.
a=4 , b=1
Other notes:
2nd choice makes no sense because a is always going to increase because of the addition on a and b was going to decrease because of the subtraction on it.
Third choice makes no sense because a/b doesn't even exist.
Fourth choice a/b is negative not nonnegative.