Answer To The Question 1: Experimental Purpose: Experimental Process
Answer To The Question 1: Experimental Purpose: Experimental Process
Answer To The Question 1: Experimental Purpose: Experimental Process
1. Experimental Purpose: By using the merge sort algorithm on the given algorithm to rank
it in ascending order.
2. Experimental Process: The coding platform was Code Blocks C++.At first, the first line
is an integer N where N is not greater than 10000.
The key to merge Sort is merge. Therefore, it is done in two steps. First, it must split the given
array, and then merge the split sub-arrays.
1) Divide the problem into a number of sub problems that are smaller instances of the same
problem.
2) Conquer the sub problems by solving them recursively. If they are small enough, solve the sub
problems as base cases.
3) Combine the solutions to the sub problems into the solution for the original problem.
1) Separate the array from the middle to obtain two new sub-arrays, and repeat the division
operation on the sub-arrays until the sub-arrays are sufficiently small (array size is 1). Then the
original merge operation.
2) When the two sub-arrays that need to be merged have only one element, compare the sizes
and merge them into a new array.
First use the first element of the two arrays to compare the size, for example, left[0] and right[0]
compare the size, if left[0]<=right[0], when *forming a new array, left[0] is The first element of
the new array; right[0] is compared with left[1]. Go on like this
If the elements of left[] are all in the new array, and right[] is not all in *the new array, add the
remaining elements of right[] to the new array in their own order.
4. Repeat the merge operation until the regenerated array is the same size as the array, and
Merge Sort ends.
4. Conclusion : The experiment was concluded successfully .There was no bug found in the
final stage. We obtained our desired merge sort
2) Experimental Process: The coding platform was Code Blocks C++.We can see that ,first
and second line of each of the input case contain two strings, which is composed of letters
and numbers, we need to make sure lengths of strings do not exceed 200.
We got two sequences, now the length of longest subsequence present in both of them. A
subsequence is a sequence that appears in the same relative order, but not necessarily
Let the input sequences be X[0..m-1] and Y[0..n-1] of lengths m and n respectively. And let
L(X[0..m-1], Y[0..n-1]) be the length of LCS of the two sequences X and Y. Following is the
recursive definition of L(X[0..m-1], Y[0..n-1]).
*A constant amount of work is done inside each iteration of the inner loop
#Answer is contained in L[n,m] (and the subsequence can be recovered from the L table).
# Applies to a problem that at first seems to require a lot of time (possibly exponential),
provided we have:
*Simple sub problems: the sub problems can be defined in terms of a few variables, such as j,
k, l, m, and so on.
*Sub problem optimality: the global optimum value can be defined in terms of optimal sub
problems
*Sub problem overlap: the sub problems are not independent, but instead they overlap
(hence, should be constructed bottom-up).
1. Experimental Purpose:
We are going to make new defensive missile that can intercept multiple attacks from
missiles. The missile we are going to make has some short comings. We cannot fly backward
or upward. We need to intercept the maximum number of offensive missiles that can be
intercepted by a defensive missile in each test. We will try to now find an algorithm which
will suit our narrative.