Answer:
Each time you insert a new node, call the function to adjust the sum.
This method has to be called each time we insert new node to the tree since the sum at all the
parent nodes from the newly inserted node changes when we insert the node.
// toSumTree method will convert the tree into sum tree.
int toSumTree(struct node *node)
{
if(node == NULL)
return 0;
// Store the old value
int old_val = node->data;
// Recursively call for left and right subtrees and store the sum as new value of this node
node->data = toSumTree(node->left) + toSumTree(node->right);
// Return the sum of values of nodes in left and right subtrees and
// old_value of this node
return node->data + old_val;
}
This has the complexity of O(n).
Explanation:
It should be noted that the hardware component that keeps data and information when the device is not powered is called a storage device.
This device can be permanent or temporary storage device.
<h3>What is a storage device?</h3>
Storage device can be regarded as the device that store data.
There are different storage devices for the computer system, they includes;
- Optical Storage Devices.
- External HDDs
- Random Access Memory
- Flash memory devices.
- Floppy Disks.
Learn more about storage device at ;
brainly.com/question/21283135
Answer:
"Computer Based Information system (CBIS)" is the correct answer for the above question.
Explanation:
- CBIS means about that system that is used to produce the information or process the information and it is computer-based because CB stands for computer-based and IS stands for an information system.
- It means that a system that helps by the computer and it is used to process the information then it can be called CBIS.
- To process the information in a computer system there is a need for software, people, database, hardware and processor which is a set of CBIS.
- The above question also wants to ask about the system which is a set of software, people, database, hardware and processor then it is known as CBIS which is described above. Hence the answer is CBIS.