This content originally appeared on DEV Community and was authored by Samanvi Thota
Performance Measurement: It is based on space and time requirements of a particular algorithm. These quantities depend on the compiler and options used, and the system on which the algorithm runs. The space and time needed for compilation are important during program testing. To obtain the run time of a program, we need a clocking procedure. We assume the existence of a program GetTime() that returns the current time in milliseconds.
Suppose if we want to measure the worst-case performance of the sequential search algorithm
we need to follow these:
1.decide on the values of n for which the times are to be obtained
2.determine for each of the above values of the data that exhibit the worst-case behavior.
Algorithm:
SeqSearch(a,x,n)
//search for x in a[1:n]. a[0] is used as additional space.
{
i:=n; a[0] :=x;
while (a[i]=!x) do i := i-1;
return i;
}
click here, for more detailed explanation with example
This content originally appeared on DEV Community and was authored by Samanvi Thota
Samanvi Thota | Sciencx (2021-05-06T17:52:56+00:00) Performance Measurement. Retrieved from https://www.scien.cx/2021/05/06/performance-measurement/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.