0% found this document useful (0 votes)
2 views

CHAPTER01 Basic Elements

The document provides an introduction to informatics, focusing on the basic elements of computer science, including information processing, algorithms, and programming. It outlines the steps in problem-solving, from defining the problem to validating the solution, and includes examples of algorithms and programming in C. The content is structured to guide students in understanding the principles of algorithmics and the development of computer programs.

Uploaded by

vosene9386
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CHAPTER01 Basic Elements

The document provides an introduction to informatics, focusing on the basic elements of computer science, including information processing, algorithms, and programming. It outlines the steps in problem-solving, from defining the problem to validating the solution, and includes examples of algorithms and programming in C. The content is structured to guide students in understanding the principles of algorithmics and the development of computer programs.

Uploaded by

vosene9386
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Higher School in Computer Science

Chapter I: Basic Elements


and Digital Technologies Introduction
What’s Informatics ?
Informatics (computer science) is the study and practice of processing,
managing, and analyzing information, particularly through the use of
technology and computer systems.
Chapter I: Basic Elements INFORMATICS

INFORMATION AUTOMATIC
Algorithmics and Static Data Structures Data : text, image, audio, number , … The art of automatically triggering actions.

Automatic processing of information


1st year preparatory class, ESTIN, Bejaia
Automatic Machine
Dr. Lamia CHEKLAT
A Computer
Year : 2024 - 2025 2

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Information Processing Definitions
Algorithmics is the science that studies algorithms.
Computers are mainly used for:
— Information processing; An algorithm is a finite sequence of elementary operations used to
solve a given problem.
— Information storage.

History
Processing refers to the set of operations performed on data
} Derived from the name of the mathematician Muhammad ibn
(information), such as sorting, calculations, text editing, etc. Musa al-Khwarizmi, the pioneer of algebra, who formalized the
concept of the algorithm in the 9th century.

3 4
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Example of algorithms Example of algorithms Let two numbers
A and B

The calculation of the sum of two numbers A and B and displaying the
result : } The most famous algorithm is
Divide Replace
Euclid's algorithm, which calculates A by B B byC

Guess the operations of the algorithm solving this problem! the Greatest Common Divisor Put the Replace
rest in C A by B
(GCD) of two numbers whose
YES
factorization is unknown C≠0?
1. Enter the first number (A)
NO
2. Enter the second number (B)
Display
3. Add A+B and store the result in C } See the flowchart
B
4. Display C
End
5 6

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Example of algorithms Rules to follow
➢ Solving a first-degree equation a*x + b = 0 in R
An algorithm:
Guess the operations of the algorithm! } Must be a sequence of elementary (primitive) operations,
1) Enter The coefficients a and b } Must take into account all possible cases (general case and special
2) if a = 0 then
3) if b = 0 then cases)
4) display("The solution set is R")
5) else } Must provide a result in a finite number of operations, regardless of
6) display("No solution")
the input data.
7) end if
8) else
} It is in principle, independent of programming languages and computer
9) sol ← - b / a
10) display("The solution is : ", sol) hardware.
11) FinSi
7 8
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Example of algorithmes The concept of a program
An algorithm consists of:
} A header consisting of the key word ALGORITHM followed by Any processing requested from the machine, by the user, is carried
the name of the algorithm to be implemented, and a declaration
out by the sequenced execution of operations called instructions. A
area the identifiers (variables) used in the algorithm.
sequence of instructions is called a program.
} A body of the algorithme delimited by two reserved words
START and END. This is where the actions of the algorithm are
written. A program is a translation of an algorithm into a programming
ALGORITHM <Name>
VAR <Declaration of variables>
language.

BEGIN
<Operations>
END 9 10

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Definitions Machine language
A program: It is a sequence of instructions that allow a computer
system to perform a given task. – A language that is directly understandable by the machine
(the computer).
Programming: It is to write a program in a given programming
language. – A sequence of 0s and 1s defining specific operations to be
performed.
Programming Language: It is a set of vocabulary and grammar rules
that can be understood by a computer. – Is not used directly for programming.

11 12
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
The concept of a program Steps in problem-solving
} The first usable language for programming a computer is assembly The automatic resolution of a problem is carried out in several steps :
language.
1) Problem Definition,
} Depends on the machine's processor.
2) Problem analysis,
} Its instructions are close to those of machine language.
3) Writing the algorithm,
} Allows for the creation of relatively simple programs
4) Simulating an execution of the algorithm,
} To create more complex and less machine-dependent programs, it is 5) Programming,
necessary to use a programming language. For example : C, 6) Solution validation.
C++, C#, Java, Python, Pascal, Lisp, Prolog, Fortran, Cobol, ...

13 14

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Steps in problem-solving Steps in problem-solving
Step 1: Problem Definition Step 2: Problem Analysis

This step consists of understanding the problem in order to identify:


It is to specify the statement of the problem to be solved.
1) Inputs (data),
2) The processes or operations that lead to the desired results from
the data,
3) The outputs (The expected results).

15 16
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Steps in problem-solving Steps in problem-solving
Step 3: Writing the algorithm Step 4 : Simulating an execution of the algorithm

After analyzing the problem, we move on to writing the algorithm The execution simulation involves running the algorithm step by step
respecting the algorithmic formalism. This mainly includes these three manually to check that it produces the expected result.
parts:

This is presented in the form of a table where each column represents


1) Reading data (inputs), a data item and each row represents a step of the algorithm.
2) Operations (processing),
3) Writing (displaying) results (outputs).

17 18

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Steps in problem-solving Steps in problem-solving
Step 5 : Programming Step 6 : Solution Validation

It involves executing the program, testing it, and verifying its


It is the translation of the algorithm into a programming language. functionality for both the general case and special cases through the
results provided.

19 20
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Steps in problem-solving Steps in problem-solving: Example
Step 1: Problem Definition
Validated
Problem Results
Erreurs
Errors

Writing the Solving a 2nd degree equation a*X² + b*X + c =0 in R


Definition Analysi Execution Programming Execution
algorithm
s Simulation
Errors

Syntax Logic

A representative schema of the steps in problem-solving.

21 22

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Steps in problem-solving: Example Steps in problem-solving: Example
Step 2: Problem Analysis Step 3: Writing the algorithm

} Inputs : Algorithm Equation


The coefficients a, b and c {Declaration of input and output data}
} Operations Begin
- Calculation of delta (delta = b²-4*a*c) {Reading data}
- Calculating the root of the delta {Processing}
- Calculation of solutions {Results display}
} Outputs: End
- The Solution (X)

23 24
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Steps in problem-solving: Example Steps in problem-solving: Example
Step 4 : Simulating an execution of the algorithm Step 5 : Programming
The translation of the algorithm to a C program.
Operations a b C Delta X #include <studio.h>
#include <stdlib.h>
int main()
{
[Declaration of input and output data]
[Instructions]
[Results display]
The algorithm is validated if the results obtained are correct. return 0;
}

25 26

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Steps in problem-solving: Example Steps in problem-solving: Exercise
Step 6 : Solution Validation

Problem:
} Test the program for the 3 cases of delta (null, positive, and Find the list of divisors of a number.
negative) using different values for a, b, and c.

} Verify the results obtained for each case,

} The program is validated if the results obtained are correct.

27 28
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Steps in problem-solving: Exercise Steps in problem-solving: Exercise

Problem analysis:
Problem definition:
— Let be an integer N
Given an integer N, find the solution to display the list of divisors of — Successively divide N by i = 1, 2, 3 ,..., N / 2
the integer N.
— Check the remainder of the division of N by i each time
— If the remainder is equal to 0, then i is a divisor
— Display i

29 30

Chapter I: Basic Elements Chapter I: Basic Elements


Introduction Introduction
Steps in problem-solving: Exercise Steps in problem-solving: Exercise

Writing the algorithm: Simulation of an execution:

algorithm Dividers N i Remainder of N by i


var N , i : integer 1 0 Display i (1)
begin
2 1
read (N)
for i from 1 to (N DIV 2) do
if (N MOD i) = 0 then
15 3
4
0
3
Display i (3)

WRITE (i) 5 0 Display i (5)


endif 6 3
endfor
7 1
end

31 32
Chapter I: Basic Elements Chapter I: Basic Elements
Introduction Introduction
Steps in problem-solving: Exercise Steps in problem-solving: Exercise

Programming : Execution (validation):

15
1
3
5

33 34

You might also like