Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Algorithm Efficiency
is used to describe properties of an
algorithm relating to how much of
various types of resources it consumes
Criteria of Algorithm Efficiency
Space Utilization – the amount of memory required
to store the data
The kinds of intruction & the speed with which the machine
can execute the intructions
- the value of T(n) cannot be express in real time units,
instead by the approximate count of the intructions
executed
1. Initialize sum = 0
2. Initialize index variable i = 0
3. While i < n do the following:
4. A. Add x[i] to the sum
5. B. Increment i by 1
end while
6. Calculate and return mean = sum / n
1 1
2 1
3 N+1
4 N
5 N
6 1
Total 3n + 4
Conclusion
The computing time for the algorithm to calculate a mean is
given by T(n) = 3n + 4
1. Initialize sum = 0
2. Initialize index variable i = 0
3. While i < n do the following:
4. A. Add x[i] to the sum
5. B. Increment i by 1
end while
6. Calculate and return mean = sum / n
1. Initialize sum = 0
2. Initialize index variable i = 0
3. While i < n do the following:
4. A. Add x[i] to the sum
5. B. Increment i by 1
a. The value of sum is the sum of the first i elements of array x
and i is the number of times execution has reached this point
end while
6. Calculate and return mean = sum / n
Macro definitions
Global variables
Class definitions
Templates
Sound: provides interfaces and classes for reading, writing, sequencing, and
synthesizing of sound data.
Text: the java.text package deals with text, dates, numbers, and messages.
XML: built-in classes handle SAX, DOM, StAX, XSLT transforms, XPath, and
various APIs for Web services, as SOAP protocol and JAX-WS.