AlGORITHM

0
306

History

The algorithm is derived from the name of the author of the book, namely Abu Ja’far Muhammad Ibn Musa Al-Khawarizmi who came from Uzbekistan. Westerners call Al-Khwarizmi Algorism.

At that time, Al-Khwarizmi wrote a book entitled Al Jabar wal-Muqabala which means ‘Book of Recovery and Reduction’ (Book of Restoration and Reduction). From the title of the book, we also get the word “algebra” or commonly known as algebra.

Abu Abdullah Ibn Musa al-Khawarizmi (770M-840M) was born in Khawarizm (Kheva), a city south of the Oxus River (now called Uzbekistan) in 770 AD Al Khawarizmi was one of the most popular scientists of his time. There are several branches of mathematics that he found, among others, known as astronomers and geographers.

Initially, the algorithm is a term that changes the arithmetic rules that are useful for completing the conversation by using Arabic numerals.

Definition

“Algorithms are sequences of logical steps to solve problems that are arranged systematically and logically.” Logical words are keywords in the algorithm. The steps in the algorithm must be logical and must be determined to be false or true.

 Compiler

Compiler is a program that translates program language (Source code) into the object language (object code) as a whole program.

Characteristic features :

• Translate as a whole

• If a compilation error occurs, the source program must be repaired and recompiled

• Object program generated

• Generated Executable program

• The program work process is faster

• Source programs are not used only for repairs

• Security of the program is more guaranteed

Compilation Stages:

In writing a computer programming language, there are several steps that must be carried out, including:

First the source code (program written) is read into computer memory.

• The source code is changed to object code (assembly language)

• Object code is associated with the library needed to form a file that can be executed.

Compilers need time to make a program

can be executed by computer. However, programs produced by Compilers can run faster than those produced by Interpreters, and are independent.

Basic Structure

The algorithm contains steps for solving a problem. These steps can be a sequence of actions (sequence), the selection of actions (selection), repetition of action (iteration) or a combination of all three. So the basic structure of algorithm development is three, namely:

 1. Threaded / Streak Structure: Used for programs whose statements are sequential or sequential.

2. Selection / Branching Structure: Used for programs that use the selection or selection of conditions.

 3. Iteration Structure: Used for programs whose statements will be executed repeatedly.

Variable

A variable is a place where we can fill or empty the value and call back if needed. Each variable will have a name (identifier) ​​and value. Or, a variable is a data storage medium whose data values ​​can change during the execution process.

Example:

Variable names and values.

username = “joni”

Name = “Udin”

Price = 2500

Total Price = 34000

In most programming languages, variables must be declared first to make the compiler work easier. If the variable is not declared, every time the compiler meets a new variable, the naming of the variable must follow the rules set by the programming language that we use. But in general there are rules that apply to almost all programming languages. These rules are:

• Variable names must begin with a letter.

• Must not use spaces in one variable name. Spaces can be replaced with underscore (_) characters.

• Variable names cannot contain special characters, such as:., +, -, *, /, <,>, &, (,) and others.

• Variable names should not use key words in the programming language

Types of Variables

1) Numerical Variables

This numeric variable is divided into 3 (three) types:

• Integers

• Decimal Numbers Single Expressions or Floating Points.

• Double precision decimal numbers.

2) Text Variables

• Character (Single Character)

• String (For Character Sequences)

Variable Writing Rules:

• Begins with letters

• The writing must be followed by the data type

• Free length

• Must not use spaces

Constants

A data that is fixed, and is used in programming is termed a constant. A constant is a place of temporary storage in memory whose value is fixed or cannot be changed. Constants must be defined first at the beginning of the program. Constants can be integers, fractions, characters or strings.

In programming there are two types of constants namely number constants and text or string constants.

Example:

Declaration

Const phi = 3.14 {Phi constant}

Const Nmaks = 100 {number of students}

Password const = ‘xyz’ {secret key}

Data Types

Data types are types of data that can be processed by computers to meet the needs of computer programming.

 Each variable or constant that is in the program code, we should determine with certainty the type of data. The accuracy of the selection of data types on variables or constants will determine the use of computer resources (especially computer memory). One of the important tasks of a programmer is to choose the appropriate data type to produce an efficient and high-performance program.

There are 2 types of data types:

1. Primitive data types are basic data types that are available directly in a programming language.

2. Composite data types are formed data types that consist of two or more primitive data types.

• Numeric data types

Numeric data types are used on variables or constants to store values ​​in the form of numbers or numbers. All programming languages ​​provide numeric data types, only differing in the numeric types that are accommodated.

 Types that are included in numeric data types include:

 1. integer (integer)

 2. float (fraction number).

 3. Single data type is a data type for fractions with limited precision

4. Double data types are data types for fractions with more accurate precision.

• Additional Data Types, which are owned by the C / C ++ language, are:

Unsigned is used when the data used is only positive data

In the algorithm there are 5 data types, namely: integer data types, real number data types, character data types, string data types and logical or boolean data types.

• Integer

Integers can be interpreted as integers. Integers are numbers that have no fractions.

• Real

The real data type is used to store real data. Real numbers are numbers that can have decimal digits behind commas (exponentials) or fractions. Real numbers can also be positive and negative.

• Character

Character data types are used to store alphanumeric data types, such as ‘A’, ‘B’, ‘*’, ‘#’, ‘8’, ’?’. All signs on the keyboard include characters. A number created for use in calculation operations or other mathematical operations must be declared as a numeric type, but if a number is only used as a code it should be declared as a character type

• String

The string data type is used to store data that is a combination of several characters. Example: ‘STICOMP’.

• Logic (boolean)

This data type only contains 2 values, namely TRUE or FALSE. By using the AND, OR operators, NOT, a more complicated boolean expression can be formed. Boolean values ​​are very important for making decisions in a program.

LEAVE A REPLY

Please enter your comment!
Please enter your name here