Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave

One clear productivity changeYou must describe the methodology you used for performing the experiments.
• Your report must describe your choice of programming language and computing environment.Alignment of programming language, environment, and where appropriate, choice of data structures, are extremely important in providing a balanced comparison between the algorithms.


• Your report must describe your programming language implementation of the given algorithms. You must ensure that the correspondence between features of the algorithms and the corresponding program code is clear, to confirm the validity of the experiments. The program code should replicate the structure of the algorithms as faithfully as possible.

• Your report must explain how you showed that your programs work correctly. Your approach should involve thorough testing. You must provide a clear explanation of how the testing corresponds to any input classes – groups of similar inputs, boundary cases and so on – identified during your formal analysis of the algorithms.

• Your report must explain clearly how you produced test data for the experiments and chose cases to test, as appropriate. Usually this will involve generating random data for different sizes of input. In particular, it is important that both algorithms are tested using the same data, to ensure that the comparative results are meaningful.

• Your report must explain clearly how you counted basic operations, e.g., by showing the relevant program code for maintaining ‘counter’ variables. In particular, it should be easy to see that the method used is accurate with respect to the original algorithms.

• Your report must explain clearly how you measured execution times, e.g., by showing the relevant program code augmented with calls to ‘clock’ or ‘time’ procedures. Since it is often the case that small program fragments execute too quickly to measure accurately, you may need to time a large number of identical tests and divide the total time by the number of tests to get useful results.

Analyzing Tasks

The main objective is to compare and analysis the two given algorithms. The tasks performed by algorithms will be analyzed. These will be analyzed by their correctness, efficiency, time complexity. Both theoretical and practical explanation will be analyzed.

The task performed by two algorithms is determining the minimum distance between two different elements presented in an array input.

Input is array elements: a[i,j]

Output : MinDistance[i,j]

Where, a represents array,

i,j represent elements in array,

MinDistance[i,j] represents distance between i,j.

One approach to do this is to register, for each component a[i], its nearest component: that is, the component a[j] with the end goal that |a[j] − a[i]| is littlest in esteem, among all j = 1..n, j 6= I. At that point locate the littlest such match, over all I = 1..n. For one component, discovering its nearest component takes Θ(n) time. Doing this for each component I and finding the general least takes Θ(n2).Another arrangement is to sort the cluster. The claim is that the match of components that are nearest in esteem must be in sequential files of the arranged exhibit. We ought to in any event endeavor to contend why this is valid (correctness) (Wilson, 2012).

ALGORITHM MinDistance(A[0..n-1])

// Input: Array A[0..n-1] of integers

// Output: Smallest distance between two of its elements 

dmin ´

for i ¬ 0 to n-1 do

for j ¬ 0 to n-1 do

if i  ¹ j and |A[i] – A[j]| < dmin

dmin  ¬ |A[i] – A[j]|

return dmin

This completes our informal description of the algorithm. Although differing in many details, it is basically the same as the algorithm given in the second algorithm, described with about the same degree of imprecision.

Improvement: considers each pair only once, performs the abs function only once

dmin ´

for i ¬ 0 to n-2 do

for j ¬ i+1 to n-1 do

temp ¬ |A[i] – A[j]|

if temp < dmin

   dmin  ¬ temp 

return dmin

Precondition: A[lo..hi] is a variety of Numbers, lo and hello there are lnts such that hello there ≥ lo − 1, and p is a Number.

Postcondition: A[lo..hi] is a stage of its unique qualities with the end goal that, all things not as much as p go before all things equivalent to p, which thus go before all things more noteworthy than p. Returns a cluster N[1..3] in which N[1] is the number of things not as much as p, N[2] is the quantity of things equivalent to p, and N[3] is the number of things more noteworthy than p in A[lo..hi]..

There are two shortcomings of the algorithm that should be noted. - The value of NN - or at least an upper bound for its value

- must be known in advance;

 - A computer b does not know when the algorithm has terminated and its distance table dist(6, -) is correct. Other methods, such as the one in [2] must be used to discover this. Before we can write a rigorous proof of its correctness, we will need a more precise statement of the algorithm. Thus both algorithms are correct (Mu?ller and Paul, 2010).

Correctness

Time proficiency is investigated by deciding the quantity of reiterations of the essential task as a component of info estimate

Basic task: the activity that contributes the most towards the running time of the calculation.

The qualities of a decent calculation are:

Accuracy – the means are decisively stated(defined).

Uniqueness – consequences of each progression are exceptionally defined and just rely upon the info and the aftereffect of the preceding steps.

Limit – the calculation stops after a limited number of instructions are executed.

Info – the calculation gets input (Weiss, 2016).

Better calculation:By sorting the cluster with O(nlogn) tasks, at that point locate the littlest separation with O(n) activities, efficiency will be improved.

One clear productivity change: sort the whole numbers to begin with, at that point you can take a gander at contiguous ones. Any number will be nearest to its neighbor either up or down.

That progressions the multifaceted nature from O(n2) to O(n log n). Honestly for the little estimation of n demonstrated it won't have a noteworthy effect, however as far as hypothetical multifaceted nature its essential.

One small scale streamlining you might need to make: utilize a nearby factor to store the consequence of Math.abs, at that point you won't have to berecomputed it if that ends up being not as much as the base. Then again, you should need to utilize dMin = Math.min(dMin, Math.abs(a[i] - a[j])). Better way is that we need to sort the cluster, at that point go over it afresh and check the separation between the arranged things. This will work since they are in rising request, so the number with the closest esteem is nearby.That arrangement will be O(nlogn).The unique documentation of O(log(n)), which demonstrates a logarithmic relationship (Kolokotrones, 2010). A case of a calculation that uses this is the twofold pursuit calculation. We need to discover a name in a one after another in order requested rundown thus we go to the middle. In the event that the name we seek precedes that, we go to the inside between the middle page and the starting (so the 1/fourth). We proceed with that until the point that we locate the correct name. The time unpredictability of that calculation is O(log(n)).

The practical part has been executed by using NetBeans Platform and code is written in java.

Algorithm 1:

Given an unsorted cluster a[] and two numbers x and y, locate the base separation amongst x and y in a[]. The cluster may likewise contain copies. You may expect that both x and y are extraordinary and exhibit in a[].

The external circle picks every one of the components of a[] one by one. The inward circle picks every one of the components after the component picked by external circle. In the event that the components picked by external and internal circles have same qualities as x or y at that point if necessary refresh the base separation figured up until this point.

Cases:

Input: a[] = {1, 2}, x = 1, y = 2

Output

Yield: The calculated minimum distance between1 and 2 is 1.

Time Complexity: O(n^2)

Algorithm 2:

1) Traverse exhibit from left side and stop if either x or y is found. Store record of this first event in a variable say prev 

2) Now cross arr[] after the list prev. On the off chance that the component at current list I coordinates with either x or y at that point check in the event that it is unique in relation to arr[prev]. In the event that it is diverse at that point refresh the base separation if necessary. In the event that it is same at that point refresh prev i.e., make prev = I.

Thus the output is shown in the above screenshot. The time Complexity of algorithm 2 is determined as: O(n).

Thus the second algorithm is better efficient than first algorithm.

The code files are attached. 

Conclusion

The tasks performed by algorithms will be analyzed. These will be analyzed by their correctness, efficiency, time complexity. Both theoretical and practical explanation are analyzed. 

References 

Kolokotrones, T. (2010). Curvature in metabolic scaling.

Mu?ller, S. and Paul, W. (2010). Computer architecture. Berlin: Springer.

Weiss, A. (2016). Efficiency wages. [Place of publication not identified]: Princeton University Pres.

Wilson, J. (2012). Myth of Political Correctness. Duke University Press.

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2020). Comparing Algorithms: Methodology, Implementation, Testing, And Efficiency. Retrieved from https://myassignmenthelp.com/free-samples/ifn-505-analysis-of-programs-for-better-calculation-and-productivity-change.

"Comparing Algorithms: Methodology, Implementation, Testing, And Efficiency." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/ifn-505-analysis-of-programs-for-better-calculation-and-productivity-change.

My Assignment Help (2020) Comparing Algorithms: Methodology, Implementation, Testing, And Efficiency [Online]. Available from: https://myassignmenthelp.com/free-samples/ifn-505-analysis-of-programs-for-better-calculation-and-productivity-change
[Accessed 24 November 2024].

My Assignment Help. 'Comparing Algorithms: Methodology, Implementation, Testing, And Efficiency' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/ifn-505-analysis-of-programs-for-better-calculation-and-productivity-change> accessed 24 November 2024.

My Assignment Help. Comparing Algorithms: Methodology, Implementation, Testing, And Efficiency [Internet]. My Assignment Help. 2020 [cited 24 November 2024]. Available from: https://myassignmenthelp.com/free-samples/ifn-505-analysis-of-programs-for-better-calculation-and-productivity-change.

Get instant help from 5000+ experts for
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing: Proofread your work by experts and improve grade at Lowest cost

loader
250 words
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Plagiarism checker
Verify originality of an essay
essay
Generate unique essays in a jiffy
Plagiarism checker
Cite sources with ease
support
close