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
Answer:
Bayesian filtering
Explanation:
This is a type of filtering software that makes use of Bayesian logic to evaluate every incoming email that you receive, analyzing the header and content of the email to determinate if it is spam or not. It uses a preset of common words that are present in most spam emails, and it categorizes all received emails according to their probability to contain spam in trusted, or not trusted email. These categories are usually set by the user.
In short, Bayesian logic uses the knowledge acquired from past events to try to predict future events. Determinate the probability of success (from 0 to 100%) of a certain activity, according to the result of prior tests. It was first suggested in 1763 after the death of its creator Thomas Bayes, and it is widely spread across several different sciences such as programming, artificial intelligence, physics, etc.
50 because the negative doesn’t matter when getting an absolute value
Answer:
The program to this question as follows:
Program:
value = input("Input text value: ") #defining variable value and input value by user
word = value.split() #defining variable word that split value
sort_word = sorted(word) #defining variable using sorted function
unique_word = [] #defining list
for word in sort_word: #loop for matching same value
if word not in unique_word: #checking value
unique_word.append(word) #arrange value using append function
print(' '.join(unique_word)) #print value
Output:
Input text value: Good morning Good afternoon Good evening
Good afternoon evening morning
Explanation:
In the above python code, a value variable is defined that uses input function to input value from the user end, and the word variable is declared, which uses the split method, which split all string values and defines the sort_word method that sorted value in ascending order.
- Then an empty list "unique_word" is defined, which uses the for loop and inside the loop, a conditional statement is used.
- In if block, it matches all value is unique if this is condition is true it will arrange all values and uses the print function to print all value.
The answer is : Click the Insert Formula icon on the Formulas tab ribbon. The formula bar is located just below the Ribbon. It displays the contents of the active cell. It can also be
used for entering or editing data and formulas. Found on the left of the formula bar, the insert icon dialog box helps the user identify and implement
functions, a type of formula that performs specialized and group calculations.