Question
IN C++ Write a function called bestSimilarity that finds the best similarity score between all subsequences of an input tune and the target tune. The
IN C++
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:
Input | Result |
---|---|
E4D5B7G2E2 D6G5G2 | 0.666667 |
A3B5D3E1G0F9 B5D8C1 | 1.66667 |
B6A2 G9B0E1D6 | 0 |
A2E9B0F1D3F1G6B0 B0G7F6B2 | -1.75 |
F0B6D8G4F2C2F1 F2 | 2 |
A3F6B0G9A2E1F4 B2E1F4 | 2.66667 |
A5 F6G5G2B7 | 0 |
A5 A7 | 1 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started