In the population, there are three major classes. People are classified into either class A (10% of the population), class B (60% of the population) or class C (30% of the population). When we pick samples from the population, we can apply (a) random sampling or (b) stratified sampling. Explain both sampling techniques using this scenario.
Draw the recursion tree for the maximum-sum subarray problem, where array is given in array
[-8, -2, -8, -5, -6, 2, 3]
You must clearly show the low , high, left-sum, right-sum and cross-sum for each step.
Write an algorithm that declares two integers and initializes them to 199 and 76. Display the sum, difference, product, average, square, and remainder of the values.
Convert the above algorithm to a Python program.
1.Start
2.Initialize Sum , Count to 1 ( Sum = 1 , Count = 1 )
3.Enter a temp
4.Add Temp to sum. ( Sum = Temp + Sum )
5.Increase Counter by 1 ( Count = Count + 1)
6.Repeat step 3 through 5 , Ten times
7.Calculat average temp in Fahrenheit (Average temp = (( sum * 9 / 5 ) + 32 ) / 10 )
8.If t Average temp is more than or equal to 97 and Average temp is less than or equal to 99 then Display “Your body temperature is normal”
9.Else Average temp is more than to 100.4 then Display “You have a fever caused by an infection or illness”
10.End.
A group of medical students were monitoring the body temperature of a patient daily basis. Students captured 10 temperature readings in Celsius on a particular day.
1. Write an Algorithm to input these ten values and get the average temperature for that day. if the average temperature value is in between 970 Fahrenheit and 990 Fahrenheit then display the message “Your body temperature is normal…”. If it is more than 100.40 Fahrenheit then display the message “You have a fever caused by an infection or illness…”.
T(n) = T(n/3) + T(2n/3)+ big O(n)
Find the upper bound of this recurrence equation with the help of recursion tree
Create pseudocode about this output.
Choices:
d. Calculator
e. Odd or Even
f. Positive or Negative Number
Enter your choice: c
Enter a number: -6
-6 is a negative number.
Create pseudocode about this output.
Choices:
a. Calculator
b. Odd or Even
c. Positive or Negative Number
Enter your choice: b
Enter a number: 80
80 is an even number.
Create pseudocode about this output
Choices:
a. Calculator
b. Odd or Even
c. Positive or Negative Number
Enter your choice: a
Enter first number: 10
Enter second number: 5
The sum of 10 and 5 is 15
The difference of 10 and 5 is 5
The product of 10 and 5 is 50
The quotient of 10 and 5 is 2
for Read 10 integers from the keyboard in the range 0 "-100" and cout how many of them are larger from than 50, and display this result by using a pseudocode