Answer:
the mistake that was made by allen is that he was not suppose to hire a highly proficient technician to install the heating and cooling system in the granary.
Answer:
import numpy as np
import matplotlib.pyplot as plt
def calculate_pi(x,y):
points_in_circle=0
for i in range(len(x)):
if np.sqrt(x[i]**2+y[i]**2)<=1:
points_in_circle+=1
pi_value=4*points_in_circle/len(x)
return pi_value
length=np.power(10,6)
x=np.random.rand(length)
y=np.random.rand(length)
pi=np.zeros(7)
sample_size=np.zeros(7)
for i in range(len(pi)):
xs=x[:np.power(10,i)]
ys=y[:np.power(10,i)]
sample_size[i]=len(xs)
pi_value=calculate_pi(xs,ys)
pi[i]=pi_value
print("The value of pi at different sample size is")
print(pi)
plt.plot(sample_size,np.abs(pi-np.pi))
plt.xscale('log')
plt.yscale('log')
plt.xlabel('sample size')
plt.ylabel('absolute error')
plt.title('Error Vs Sample Size')
plt.show()
Explanation:
The python program gets the sample size of circles and the areas and returns a plot of one against the other as a line plot. The numpy package is used to mathematically create the circle samples as a series of random numbers while matplotlib's pyplot is used to plot for the visual statistics of the features of the samples.
Answer:
True is the correct answer for the above question.
Explanation:
- To secure the data is the first rule for any organization because when the data is lost or unsecured the whole system can have the problem.
- If any person wants to hack the system or any organization then they first choose to hack the data of the system.
- So there is a Hundred of law in the US taken by the US government at the Federal trade commission act to secure the data of the organization.
- The above question also states the same which is defined above. Hence It is a true statement.
Answer:
See explaination for the program code
Explanation:
The code below
Pseudo-code:
//each item ai is used at most once
isSubsetSum(A[],n,t)//takes array of items of size n, and sum t
{
boolean subset[n+1][t+1];//creating a boolean mtraix
for i=1 to n+1
subset[i][1] = true; //initially setting all first column values as true
for i = 2 to t+1
subset[1][i] = false; //initialy setting all first row values as false
for i=2 to n
{
for j=2 to t
{
if(j<A[i-1])
subset[i][j] = subset[i-1][j];
if (j >= A[i-1])
subset[i][j] = subset[i-1][j] ||
subset[i - 1][j-set[i-1]];
}
}
//returns true if there is a subset with given sum t
//other wise returns false
return subset[n][t];
}
Recurrence relation:
T(n) =T(n-1)+ t//here t is runtime of inner loop, and innner loop will run n times
T(1)=1
solving recurrence:
T(n)=T(n-1)+t
T(n)=T(n-2)+t+t
T(n)=T(n-2)+2t
T(n)=T(n-3)+3t
,,
,
T(n)=T(n-n-1)+(n-1)t
T(n)=T(1)+(n-1)t
T(n)=1+(n-1)t = O(nt)
//so complexity is :O(nt)//where n is number of element, t is given sum