Shuffle (A[1..m], B[1..n], C[1..m+n]):
Shuf[0, 0] ← True
for j ← 1 to n
Shuf[0, j] ← Shuf[0, j − 1] ∧ (B[j] = C[j])
for i ← 1 to n
Shuf[i, 0] ← Shuf[i − 1, 0] ∧ (A[i] = B[i])
for j ← 1 to n
Shuf[i, j] ← False
if A[i] = C[i + j]
Shuf[i, j] ← Shuf[i, j] ∨ Shuf[i − 1, j]
if B[i] = C[i + j]
Shuf[i, j] ← Shuf[i, j] ∨ Shuf[i, j − 1]
return Shuf[m, n]
The algorithm runs in O(mn) time.
Answer:
Below are the program for the above question:
Explanation:
#include <stdio.h>//header file.
int main()//main function.
{
int value; //variable declaration.
printf("Enter a number to find its roman value: ");//render a message for the user.
scanf("%d",&value); //take a value from the user.
switch(value)//switch case starts
{
case 1:
printf("I");
break;
case 2:
printf("II");
break;
case 3:
printf("III");
break;
case 4:
printf("IV");
break;
case 5:
printf("V");
break;
case 6:
printf("VI");
break;
case 7:
printf("VII");
break;
case 8:
printf("VIII");
break;
case 9:
printf("IX");
break;
case 10:
printf("X");
break;
}//switch case ends.
return 0;//return statement.
}
Output:
- If the user inputs as 4, then the output is "IV".
Code Explantion :
- The above code is in c language, in which the scanf function is used to take the inputs from the user.
- Then the value match from the switch case and display the suitable result.
- And the user get the roman value from the user.
Answer:
a and d
Explanation:
A. Run the parted command
D. Reboot the system
These two actions will make it easier to manually reload the fdisk
Program to display greater number:
#include <iostream> <em>// Needed to perform IO operations </em>
#include<conio.h> <em> // header file</em>
using namespace std;
int main() //start of the program
{
int a , b =0; //initialising the two integer variable
cout<< "Enter first number"<<endl;
cin >> a; //user's first number
cout<< "Enter second number"<<endl;
cin >> b; //user's second number
if (a>b) //comparing the two integers input by user
cout<< a << "is greater than" << b; //display the greater number
else
cout<< b << "is greater than" << a;
return 0; // exist
}
Answer: Cookies are messages that web servers pass to your web browser when you visit Internet sites