Flow control is one of the main building blocks that determines how a program should run. Ghana Cocoa Growing company wishes to compare the impart of two newly acquired fertilizers on cocoa. They will do this by applying the same quantity of the two fertilizers on two similar but different cocoa plant under the same conditions (humidity, sunlight, soil moisture etc.). They will then choose the fertilizer whose crop produces the best harvest (highest quantity per square feet). As a programmer,
a. Suggest a flow control method that would be used to do the comparison and explain the reason why you chose it.
b. Write a flow control statement that would do the comparison in “a” above.
Take ‘n’ historic sites in Tamil Nadu as input. Design and implement a code in c language using brute force approach that identifies the shortest possible route for a traveller to visit these sites and come back to his starting point.
write a program for Strassen’s matrix multiplication algorithm using divide and conquer approach in c language.
Problem 3: In the country of WeirdLand, there is only one barber shop. In the shop there are 3 barbers, Alpha, Beta and Gamma, who are not always efficient as employees. All the customers are seated in a waiting area, each customer has a card which has a unique integral ID. For calling next person from the waiting area each barber has his own weird way: Alpha: He will call either the person with least ID from the waiting area of the one with max ID. Min or Max is decided randomly by him (assume 50% probability for each min or max). Beta: He will choose a ‘k’ and will call the kth smallest ID, (Kth ID when all IDs are arranged in ascending order). K is chosen randomly from the number of persons available in waiting area (1 <= K <= Total persons)
In the country of WeirdLand, there is only one barber shop. In the shop there are 3
barbers, Alpha, Beta and Gamma, who are not always efficient as employees. All the customers are seated in a waiting area, each customer has a card which has a unique integral ID. For calling next person from the waiting area each barber has his own weird way:
Alpha: He will call either the person with least ID from the waiting area of the one with max ID. Min or Max is decided randomly by him
Beta: He will call the kth smallest ID, (Kth ID when all IDs are arranged in ascending order). K is chosen randomly(1 <= K <= Total persons)
Gamma: He will always choose the median ID. If there are ‘n’ people in the waiting area, the median will be defined as (n+1)/2 th ID when all of them are arranged in ascending order. (For both odd and even ‘n’ )
Your task is to design a data structure which should support the query of each of the three
barbers. The data structure should be highly efficient.
In this assignment, let's build a Yoga page by applying the concepts we learned till now. You can use the Bootstrap concepts and CCBP UI Kit as well.
Sum of the series
Write a program to find the sum S of the series where S = x - x^3 + x^5 + ....... upto N terms.
Input
The first line of input is an integer X. The second line of input is an integer N.
Explanation
If we take X value as 2 in the series upto 5 terms.
Then the series is 2 - 23 + 25 - 27 + 29
So, the output should be
410.
Sample Input 1
2
5
Sample Output 1
410
Sample Input 2
3
2
Sample Output 2
-24
Right Angled Triangle - 3
Given an integer number N as input. Write a program to print the right-angled triangular pattern of N rows as shown below.
Input
The first line of input is a positive integer.
For example, if the given number is
5, the output should be
______
| /
| /
| /
| /
|/
Sample Input 1
5
Sample Output 1
______
| /
| /
| /
| /
|/
Sample Input 2
7
Sample Output 2
________
| /
| /
| /
| /
| /
| /
|/