The **algorithm** is a sequence of logical steps in solving problems systematically arranged. The problem can be anything, with a note to every problem there is a requirement that the initial conditions must be met before running the algorithm.

The concept of the algorithm is often equated with a prescription. A recipe usually have a list of ingredients or spices that will be used, the order of execution, and how the results of the processing sequence. If the material used is not listed (not available), then the prescription will not be workable. Likewise, if the order process is not uniform, then the expected results will not be obtained.

Different algorithms can be applied to a problem with the same conditions. The level of complexity of an algorithm is a measure of how much the algorithm computation required to solve the problem. Generally, the algorithm can solve a problem in a short time has a low level of complexity, while the algorithm that takes a long time to solve a problem requires a high level of complexity.

Algorithm Selection Criteria

**Out put**

Referring to the definition of the algorithm, the algorithm should have the output must be a solution of the problem being solved.**Effectiveness and efficiency**

Said to be effective if the algorithm generates an appropriate solution to the problems solved, in the sense that the algorithm should be appropriate.

Said to be efficient if the processing time of an algorithm is relatively shorter and less use of computer memory.**Finite number of steps**

Rows of instruction are made to be in a certain order or to be finite so that the problems encountered can be resolved by not requiring a relatively long time.**(semi**Algorithm) Ends

Troubleshooting should stop. And can cause other problems.**Structured**

Problem solving using the steps in order.

Consider the following simple algorithm:

**Algorithms to calculate the area of a triangle.**

`start`

Read the data base and height

Broad is the base times the height times 0.5

Show Size

stop

The above algorithm is very simple algorithm, there are only five steps. In this algorithm may not find looping or election. All of the steps is performed only once.

Glance algorithm above is true, but if we look closely then this algorithm contains a fundamental error, namely: there is no restriction on the value of the data to the base and height. What if the value of the data base or higher is the number 0 or a negative number? Obviously the results out to be not as expected. In cases like this we need to add a step to ensure the value of the base and high qualified, for example by checking the incoming input. If the input value of the base and the height is less than 0, then the program will not run. So that the above algorithm can be changed to be like the following example.

Another example:

**The result of the calculation algorithm repair area of the triangle.**

`start`

Read the data base and height

Check the data base and height, if the value of the data base and the height is greater than zero then proceed to step 4 if not then stop

Broad is the base times the height times 0.5

Show Size

stop

From the above explanation can be concluded about the basic algorithm. First, the algorithm must be true. Second, the algorithm must stop and after the stop, the algorithm gives the correct result.

ALGORITHM ANALYSIS

- How to plan an algorithm

Determine some models / design as problem solving so that it appears some models that will be taken where the best solution. - How to declare an algorithm
- How validity of an algorithm
- How to analyze an algorithm
- How to test the program of an algorithm

Method / procedure of algorithm

- Words
- The flowchart
- Statement program

ALGORITHM TEST STAGE PROCESS

**Debugging Phase**

Phase of a process executable program that will make corrections to the program error / error. This program errors may be errors in the writing program either logic or syntax.**Profiling Phase**

Phase that will work if the program is correct.

Understanding LOGIC

The logic is derived from the Greek meaning LOGOS science. Logic basically philosophical thought. Thinking means perform an action that has a purpose. So understanding Logic is the science of thought / thinking with a variety of actions that have a specific purpose.

Different Between Algorithms and Programs

The program is a set of computer instructions, whereas systematic methods and stages in the program is the algorithm. The program is written using a programming language. So can we call that the program is an implementation of a programming language.

Some experts gave a formula that somehow data structures and algorithms are closely related to a program. Good algorithm without selecting appropriate data structure will make the program less good, semikian versa.

Making the algorithm has many advantages such as:Manufacture or writing the algorithm does not depend on any programming language, meaning independent of writing algorithms and computer programming language that executes it.

- Writing the algorithm does not depend on any programming language, meaning independent of writing algorithms and computer programming language that executes it.
- Algorithmic notation can be translated into various languages.
- Regardless of the programming language, which will be issued the same output as the same algorithm.

Some things you need to note in writing the algorithm:

- The text contains a description of the algorithm steps to resolve the problem. The description can be written in any notation as long as it is easy to understand and be understood.
- There is no standard notation in the text entry such algorithms in a programming language notation. Notation used in writing algorithms called algorithmic notation.
- Each person can make a rule writing and algorithmic notation itself. This is because the text algorithm is not the same as the program text. But that algorithmic notation easily translated into a specific programming language notation, the notation should correspond to the notation of the algorithmic programming languages in general.
- Algorithmic notation is not a programming language notation, because it pseudocode in algorithmic notation can not be executed by the computer. To be executed by a computer, the pseudocode in algorithmic notation must be translated or Programs = Algorithms + Data Structures translated into the selected programming language notation. Keep in mind that the person who wrote the program is very dependent on the rules of grammar and run the engine specifications.
- Actual algorithm used to assist us in converting the problem into a programming language.
- The algorithm is the result of conceptual thinking, so that can be implemented by computer, the algorithm must be translated into a programming language notation.

There are several things that must be considered when the translation is:

**Variable declaration.**

What programming language to be used require variable declaration because not all programming languages need it.**Selection of data types.**

If the programming language to be used require variable declaration it is necessary to consider when selecting the type of data.**Usage instructions.**

Some instructions have the same functionality but each has different advantages and disadvantages.**Syntax rules.**

At the time of writing the program we are bound by the rules of syntax of the programming language to be used.**Display results.**

At the moment we are not thinking of making algorithms view the results will be presented. Technical things we noticed when convert them into the program.**The operation of the compiler or interpreter.**

The programming language used include groups compiler or interpreter.

Some of the requirements to make a good algorithm is:

**High confidence level (reliability).**

The results of the process should be high accuracy and correct.**Efficient processing (low cost).**

The process should be completed as soon as possible and frequency calculations were as short as possible.**General nature.**

Not something just to finish one case alone, but also for other more general cases.**Could be developed (expandable).**

It must be something that we can further develop based on existing requirements change.**Easy to understand.**

Anyone who read, he will be able to understand your algorithm. Hard to pin down a program would make it difficult in-maintenance (managed).**High portability (Portability).**

Can be easily implemented in a variety of computer platforms.

Algorithm Presentation

Algorithm Presentation can be outlined in 2 forms of presentation that is writing and drawing. Algorithms are presented with writing that is the structure of a particular language (eg, Indonesian or English) and pseudocode. Pseudocode is a code that is similar to the actual programming code. Pseudocode is written based on a specific programming language for example Pascal, C or Python, so it is more appropriately used to describe algorithms which will be communicated to the programmer. Pseudocode is more detailed than the structure of the English language, for example in the states syntax, data types used and others. While the algorithm is presented with an image, for example with the flowchart. Flowchart is not the only way to describe or explain the algorithm. Other ways include:

**Structure chart****DFD (Data Flow Diagram)****Warnier Diagram****IPO (Input Process Output)****HIPO (Hierarchical Input Process Output)**

Flowchart (flowchart) is a graphical representation of an algorithm or procedure to solve a problem. By using the flowchart will allow us to check whether there are parts that forgotten in the analysis of the problem. In addition, the flowchart is also useful as a facility for communication between programmers working in a project team. Flowchart there are two kinds:

**System Flowchart**

That is a flow diagram illustrating a system of computer equipment that is used in the data processing and the relationship between the equipment. Flowchart system used to describe the sequence of steps to solve the problem but only to describe the procedures established in the system.**Program Flowchart**

That is a chart that illustrates the logic sequence of a troubleshooting procedure. Symbols used are American National Standards Inc.

Stages of Programming

Previous need to understand three basic understanding of the program, programming languages and programming. The program is said, expressions, statements compiled and assembled into a single entity in the form of a sequence step procedure to solve the problem that is implemented by using a programming language that can be executed by a computer. Programming language is the procedure or manner of writing programs. While programming is the process of implementing the sequence of steps to solve a problem by using a programming language.

Programming includes two stages:

**Problem Solving Phase****Implementation Phase**

Steps to resolve the problem are as follows:

**Understand or analyze problems**

Things that should be known in the analysis of the problem so that we know how these problems:

- Initial conditions, ie inputs are available
- The final condition, namely the desired output
- Other data available
- Operators are available
- Terms or constraints that must be met

**Designing or formulating algorithms**

When the problem is complex then we divide into modules. Phase of the algorithm often starts from a global first step. This global step was refined to become more detailed step or detail. This approach is very useful in making algorithms for complex problems. Smoothing lanngkah by breaking step into several steps. Each step is described further into simpler steps. The smoothing step will continue until each step is quite detailed and precise to be implemented by the processor.

The characteristics of a good algorithm:

**Precise (right & conscientious)**

Each instruction must be written carefully and no doubt, so each instruction must be stated explicitly and not be discarded because the processor is assumed you know. Each step must be clear and definite.**The number of steps or instructions finite and indefinite**

This means that for the same case, a certain number of steps remain and although the data are different.**Effective**

There should be no instruction that can not be done by the processor that will run it.**Must terminate**

The course of the algorithm should be no stopping criteria. The question is whether, if the number of instructions a finite then surely terminate?**The resulting output right**

If the logical algorithm steps are followed carefully and then produced the desired output.

**Writing Program**

The algorithm has been made translated into computer language into a program. When writing a program, a programmer will be bound by the syntax-syntax of the instruction in the programming language used. This does not happen when preparing or making algorithms because no standardized notation in the text entry such algorithms in a programming language notation. Notation used in writing algorithms called algorithmic notation. Each person can make a rule writing and algorithmic notation itself. This is because the text algorithm is not the same as the program text. But that algorithmic notation easily translated into a specific programming language notation, the notation should correspond to the notation of the algorithmic programming languages in general.

Algorithmic notation is not a programming language notation, because it pseudocode in algorithmic notation can not be executed by the computer. To be executed by a computer, the pseudocode in algorithmic notation should be translated or translated into the selected programming language notation. Keep in mind that the person who wrote the program is very dependent on the rules of grammar and run the engine specifications. It should be noted that the selection of the wrong algorithm will cause the program to have an unfavorable performance.

The program has a good standard of assessment:

**T****roubleshooting Techniques Standard**

**Top-Down Technique**

Troubleshooting techniques most commonly used. The principle is a complex problem is divided into several groups of smaller problems. From the small problem analysis. If possible then the problem will be divided again into sub-sections and then put together following the steps for completion in more detail.**Bottom-Up Technique**

The principle of bottom-up technique is a complex problem solving is done by combining the existing procedures into one unified program as the problem resolution.

**Standard programming**

- Truth logic and writing
- The minimum time for writing programs
- The maximum speed of execution of the program
- Expression memory usage
- Ease of caring for and develop programs
- User friendly
- Portability
- Modular programming
- Standard program treatment
- Documentation
- Instruction Writing
- Standard procedure

**Test Results**

The first time should be tested whether the program can be run. If the program can not run it needs to be repaired writing syntax but if the program can run it must be tested using the usual data is data that is expected by the system created and extreme data is data that is not expected by the system. Examples of such programs require extreme data is input the amount of data but the user to fill with negative numbers. The program should be tested using a relatively large data. Repairing or correcting an error or mistake can be very expensive because there are several reasons, including:

- Program created by any programmer could have a different structure even though the results are the same. So if we can not understand the purpose of the rectification program programmers will take a long time and inefficient.
- In the error correcting program, we must see the need now. So could the error program is tailored to the current situation.
- Fixing the error took a long time because of improvements to the error could cause another error or correct other errors so that everything can be resolved.
- Correcting errors of course will learn the purpose of the overall program and its data structures. So of course, will require a lot of time, in addition to the costs incurred.
- Creating documentation

Documentation of the program there are two kinds of internal and external documentation documentation. Internal documentation is documentation generated in each of our programs that we should write a program line comment or information that allows us to remember the logic contained in the instruction, it is very useful when one day the program will be developed. External documentation is documentation of the programs conducted outside the program that makes the user guide or manual of rules or how to run the program.

**Programs Used**

If the program we have made are in accordance with what we want then we can use the program.

Basic Structure Algorithm

The algorithm contains steps to resolve a problem. Such measures may include actions of runs (sequences), the selection of the action (selection), the repetition of the action (iteration) or a combination of all three. So the basic structure of the algorithm builder there are three, namely:

**Sequence Structure**

Used to program the sequential instruction or order.**Selection Structure**

Used for programs that use the selection or screening conditions.**Repetition Structure**

Used for program instructions are executed repeatedly.

Algorithm Efficiency

Things to consider in making the algorithm is a process. To determine the exact time is a difficult job. Analysis desirable to express the efficiency of the algorithm must be made in general terms to be used in all algorithms, regardless of its implementation. In analyzing an algorithm we must focuses itself on active operations which is central to the program, which is part of the most frequently executed program. Other parts such as data entry, assignment and so can be ignored, because this section is not executed as often as active operation. The number of active operations execution was then calculated.