Question: Trying to write some code for this and struggling to find the correct way to write this. This is my code below. double tuneSimilarity(std::string tune1,

Trying to write some code for this and struggling to find the correct way to write this. This is my code below.
double tuneSimilarity(std::string tune1, std::string tune2);
double bestSimilarity(std::string inputTune, std::string targetTune) {
if (inputTune.length()
return 0;
}
double best_score = -INFINITY;
for (int i = 0; i
std::string subsequence = inputTune.substr(i, targetTune.length());
double score = tuneSimilarity(subsequence, targetTune);
if (score > best_score) {
best_score = score;
}
}
return best_score;
}
Write a function called bestSimilarity that finds the best similarity score between all subsequences of an input tune and the target tune. The input tune will always be as long as or longer than the target tune. In other words, this function will find the best possible similarity score that a tune could have. See the worked example in the project 1 instructions for a more detailed example. Function Specifications: - Name: bestSimilarity() - Parameters (Your function should accept these parameters IN THIS ORDER): - inputTune (string): The input tune to be checked against the target (length greater than or equal to the target tune) - targetTune (string): The target tune - Return Value: The best possible similarity score (double) - The length of inputTune should be greater than or equal to the length of targetTune. If inputTune is shorter than targetTune, your function should return 0. - The function should not print anything. - This function should make use of the tuneSimilarity function created in question 4. - You may assume that the input to bestSimilarity will always be valid SPN, i.e. you do not have to account for arbitrary strings. We have provided a tuneSimilarity function for you to call. Do not paste your tuneSimilarity function below. Paste only your bestSimilarity function in the answer box! Do not paste main or \#includes, just the function. For example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
