<u>Solution and Explanation:</u>
Linear time algorithm to update the label of all vertices in T :
-> It is given that the binary tree " T = ( V , E ) " with root node " r E V " . " P( V ) " is the node adjacent to ' V ' in the path from " r " to " V ".
-> By rule , "P ( r ) = r " and is defined that "Pk ( V ) - P k-1 ( P (V )) " and " P " (V ) = P (V )' for "K > 1 "
-> From the above defined statement , it means that
Pt ( V )" is ancestor of " V "
-> In this binary tree, each vertex , " V " is associated with the non - negative integer label "l(V)"
The following linear time alogrithm maintains the label of all the vertices currently on stack in an individually array. As the path may contain at 'n' vertices in tree, so the length of array is at most 'n'.
Please see the attached file.
Answer:
Please see the attached file for the complete answer.
Explanation:
Answer:
The program to this question can be given as:
Program:
#include<iostream> //include header file.
using namespace std;
int min_divisor(int n) //define function
{
if(n<=0) //if statement (base case)
{
return -1; //return value.
}
else
{
cout<<"Recursive Function call: "<<n<<endl; //print value
for(int i=2;i<n/2;i++) //loop
{
if(n/i==0) //if statement
{
return n/i; //return value.
}
}
}
}
int main() //main function
{
int n; //variable decalration
cout<<"Enter a number:";
cin>>n;
int res=min_divisor(n); //calling function
cout<<"min divisor is: "<<res<<endl; //print value
}
Output:
Enter a number: 5
Recursive Function call: 5
min divisor is: 2
Explanation:
In the above program firstly we include the header file that is iostream. It stands for standard input output stream.Then we declare a function that name is already given in question that is min_divisor(int n). In this function there is a one parameter. In the function we use if-else statement in if block n less then equal to 0 it will return value that is -1. In else block It will print the value first then we use the loop. It starts from the 2 and end from n/2. In this loop we divide the value of n and check that if the value is equal to 0 so it will return n/i. Then we declare the main function in the main function we declare variable in this variable we take user input and pass into the function by calling it and hold the return value of the function into variable res variable and print it.
A user who wants to print a spreadsheet horizontally on a piece of paper instead of vertically to fit more columns on a single page should check the portrait orientation check box.
<h3 /><h3>What is a Spreadsheet?</h3>
A spreadsheet is basically a term used to describe any computer application that is used to <em>compute, organize, analyse and store data</em> in tabular form.
Spreadsheets applications play a crucial role today as they help to make the work of educators more efficient. The next time you come across data presented in a tabular form, do remember it was likely made possible by a spreadsheet application.
You can learn about spreadsheets here brainly.com/question/26919847
#SPJ1