## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

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 Time Efficiency – the amount of time required to process the data

**Algorithm Execution Time Factors
**

Size of the input – the number of input items affects the time required for the process to be completed - Example: the time it takes to sort a list of items depends on the number of items in the list. Thus, the execution time T of an algorithm must be expressed as a function T(n) of the size n of the input. 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 Quality of the source code that implements the algorithm & the quality of the source code generated by the compiler from the source code

**Algorithm to Calculate a Mean
**

/* Algorithm to find the mean of x[0],...,x[n-1] */ 1. 2. 3. 4. 5. Initialize sum = 0 Initialize index variable i = 0 While i < n do the following: A. Add x[i] to the sum B. Increment i by 1 end while 6. Calculate and return mean = sum / n *note: statements 1 and 2 are each executed 1 time, statement 4 & 5 which comprise the body of the while loop are each executed n times, and statement 3 which controls the repetition is executed n + 1 times, since 1 additional check is required to detemine that the control variable i is no longer less than the value of n. Statement 6 is executed 1 time.

Summarized Analysis

Statement 1 2 3 4 5 6 Total # of time executed 1 1 N+1 N N 1 3n + 4

Conclusion

The computing time for the algorithm to calculate a mean is given by T(n) = 3n + 4 So as the number of input increases, the value of T(n) at a rate proportional to n, so we say the T(n) has “order of magnitude n” T(n) is O(n)

**Proving ALgorithms Correct
**

It is a deductive proof of a program’s correctness - consist of: Precondition – Pre(the “Given”) Postcondition – Post(the “To show:”)

Example

/* Algorithm to find the mean of x[0],...,x[n-1] */ 1. 2. 3. 4. 5. Initialize sum = 0 Initialize index variable i = 0 While i < n do the following: A. Add x[i] to the sum B. Increment i by 1 end while 6. Calculate and return mean = sum / n Pre: Input consist of an integer n ≥ 1 and an array x of n real numbers. Post: Execution of the algorithm will terminate, and when it does, the value of the variable mean is the mean(average) of x[0],..., x[n-1]

Note:

To demonstrate that the postcondition Post follows from the precondition Pre and the execution of the algorithm,one usually introduces, at several points in the algorithm, intermediate assertions about the state of processing when execution reaches these points. For the preceding algorithm we might use an additional intermediate assertion at the bottom of the while loop that will be true each time execution reaches this point. Such assertion is called loop invariant.

Loop Invariant

Pre: Input consist of an integer n ≥ 1 and an array x of n real numbers. 1. 2. 3. 4. 5. Initialize sum = 0 Initialize index variable i = 0 While i < n do the following: A. Add x[i] to the sum 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 Post: Execution of the algorithm will terminate, and when it does, the value of the variable mean is the mean(average) of x[0],..., x[n-1]

**Standard Algorithm in Java
**

In java it is know as “standard library” or “java class library” (JCL) the library that is conventionally made available in every implementation of that language. In some cases, the library is described directly in the programming language specification; in other cases, the contents of the standard library are determined by more informal social practices in the programming community.

**Standard Library Includes
**

Subroutines Macro definitions Global variables Class definitions Templates Most standard libraries include definitions for at least the following commonly used facilities: Algorithms (such as sorting algorithms) Data structures (such lists, trees and hash tables) Interaction with the host platform, including input/output and operating system calls

**Java Class Library (JCL)
**

is a set of dynamically loadable libraries that Java applications can call at runtime. The Java Class Library is almost entirely written in Java itself, except the parts that need to have direct access to the hardware and operating system (as for I/O, or Graphic Rasterisation). The Java classes that give access to these functions commonly use java native interface (JNI) wrappers to access the native API of the operating system.

**Purposes of JCL within the Java Platform
**

Like other standard code libraries, they provide the programmer a well-known set of functions to perform common tasks, such as maintaining lists of items or performing complex string parsing. In addition, the class libraries provide an abstract interface to tasks that would normally depend heavily on the hardware and operating system. Tasks such as network access and file access are often heavily dependent on the native capabilities of the platform. Finally, some underlying platforms may not support all of the features a Java application expects. In these cases, the class libraries can either emulate those features using whatever is available, or provide a consistent way to check for the presence of a specific feature.

Java Platform

**Main Feature of JCL
**

Features of the Class Library are accessed through classes grouped by packages. java.lang contains fundamental classes and interfaces closely tied to the language and runtime system. I/O and networking: access to the platform file system, and more generally to networks, is provided through the java.io, java.nio, and java.net packages. Mathematics package: java.math provides regular mathematical expressions, as well as arbitrary-precision decimals and integers numbers. Collections and Utilities : provide built-in Collection data structures, and various utility classes, for Regular expressions, Concurrency, logging and Data compression.

**Main Feature of JCL (cont)
**

GUI and 2D Graphics: the java.awt package supports basic GUI operations and binds to the underlying native system. It also contains the 2D Graphics API. The javax.swing package is built on AWT and provides a platform independent widget toolkit, as well as a Pluggable look and feel. It also deals with editable and non-editable text components. 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. Image package: java.awt.image and javax.imageio provide APIs to write, read, and modify images. XML: built-in classes handle SAX, DOM, StAX, XSLT transforms, XPath, and various APIs for Web services, as SOAP protocol and JAX-WS. CORBA and RMI APIs, including a built-in ORB

**Main Feature of JCL (cont2)
**

Security and Cryptography Databases: access to SQL databases is provided through the java.sql package. Access to Scripting engines: the javax.script package gives access any Scripting language that conforms to this API. Applets: java.applet allows applications to be downloaded over a network and run within a guarded sandbox Java Beans: java.beans provides ways to manipulate reusable components.

END

- HP0-M31Gayathri Nishtala
- OSG Accounting System DesignMazen Dabet
- DOC60E97bmonaanda
- Roadmapmohitsuppal
- Algorithms and Flowcharts 1Lara Joy Flores
- As400Radhakrishnan Kandhasamy
- Exploring Architecture Using Mobile Archetypestubagusrizal
- Ch0Mohsin
- Introduction To Computer ProgrammingOladele Campbell
- Graphics Libraray in CKiran Jandu
- Gatitopudreteestupido
- Csc115 Chapter 2bShahriar Kabir
- scimakelatex.11389.vaina.ewewepdfLK
- 1-4 AVR Studio TutorialHo Trung Chi
- adt1Arash Singh
- Cadence TutorialChristopher Patterson
- A Methodology for the Refinement of XMLGath
- SLConsole Release Notes FRS 6.65lucas
- Russ: Investigation of Forward-Error Correctionf326071
- QuestionPack.Comp1.DesignDryRunShakila Shaki
- scimakelatex.31676.randomzoteLK
- CallingCLibraryRoutinesfromJavav__gkumar
- An Exploration of Systems Using EYERqzldgncz
- Computational Group theory.docxjhonind
- Non-Convergence of the Approximate Maximum Likelihood Identification Algorithmmehnar52
- Readmetool kitSyed Aal-Hussain
- Relex 7 Reference Manual (1)Ruben
- tLuck
- Nagesh JadhavNagesh Jadhav
- Authenticated, Reliable Theory for Model Checkingcanada909090

- tmpAA72Frontiers
- Analysis & Design Algorithm MCQ'SGuruKPO
- tmpCB3F.tmpFrontiers
- UT Dallas Syllabus for se3345.502.07f taught by Ivor Page (ivor)UT Dallas Provost's Technology Group
- Clustering on Uncertain DataInternational Journal for Scientific Research and Development
- Improved Positive and Negative Quantitative Association Rule Mining using SAMInternational Journal for Scientific Research and Development
- UT Dallas Syllabus for cs4349.501 06f taught by Ramaswamy Chandrasekaran (chandra)UT Dallas Provost's Technology Group
- UT Dallas Syllabus for opre7313.001.08f taught by Milind Dawande (milind)UT Dallas Provost's Technology Group
- A Survey on Gesture RecognitionInternational Journal for Scientific Research and Development
- tmp8BC6Frontiers
- Comparison of different Sub-Band Adaptive Noise Canceller with LMS and RLSInternational Journal for Scientific Research and Development
- A Survey of Various Intrusion Detection SystemsInternational Journal for Scientific Research and Development
- Adoption of Parallel Genetic Algorithms for the Solution of System of EquationsWhite Globe Publications (IJORCS)
- Determining the shortest path for Travelling Salesman Problem using Nearest Neighbor AlgorithmInternational Journal for Scientific Research and Development
- Retiming Of Delayed Least Mean Square Algorithm for Adaptive Filter: A ReviewInternational Journal for Scientific Research and Development
- tmp5056.tmpFrontiers
- Principles of parallel algorithm models and their objectivesInternational Journal for Scientific Research and Development
- UT Dallas Syllabus for cs3345.501 05s taught by Greg Ozbirn (ozbirn)UT Dallas Provost's Technology Group
- Hashing Algorithm: MD5International Journal for Scientific Research and Development
- Public Cloud Partition Using Load Status Evaluation and Cloud Division RulesInternational Journal for Scientific Research and Development
- Voice Recognition System using Template MatchingWhite Globe Publications (IJORCS)
- UT Dallas Syllabus for cs2305.002 05f taught by Timothy Farage (tfarage)UT Dallas Provost's Technology Group
- tmpDF60.tmpFrontiers
- Scheduling Resources In a Hetero-Gene Cloud Using Genetic AlgorithmInternational Journal for Scientific Research and Development
- Content-Based Image Retrieval Using Features Extracted From Block Truncation CodingInternational Journal for Scientific Research and Development
- OCR for Gujarati Numeral using Neural NetworkInternational Journal for Scientific Research and Development
- UT Dallas Syllabus for cs3333.001.11s taught by Jeyakesavan Veerasamy (veerasam)UT Dallas Provost's Technology Group
- A Survey of Modern Data Classification TechniquesInternational Journal for Scientific Research and Development
- tmpC0CF.tmpFrontiers
- tmp904.tmpFrontiers

- sofpac 01 Accounting Reviewteztdummy
- dastalDEMOteztdummy
- SOFPAC 02 Accounting Cycle of a Service Business and Bankteztdummy
- sofpac 01 Introductionteztdummy
- sofpac 02 Accounting Cycle of a Service Business and Bankteztdummy
- SOFPAC 01 Accounting Reviewteztdummy
- SOFPAC 01 Introductionteztdummy
- Hashing (DASTAL)teztdummy
- Searching (DASTAL)teztdummy

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading