0% found this document useful (0 votes)
2 views36 pages

Cours Computer Science 1-Chapter 1

The document outlines a course on Computer Science 1, focusing on algorithmic thinking and control structures in Python, as part of a Bachelor's degree in Material Sciences at the University of Algiers. It covers the history of computing, definitions of computers and programs, the importance of algorithms, and the basic components of computer systems. The course aims to provide foundational knowledge in computer science, including the evolution of computing technologies and the role of algorithms in problem-solving.

Uploaded by

boostube123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views36 pages

Cours Computer Science 1-Chapter 1

The document outlines a course on Computer Science 1, focusing on algorithmic thinking and control structures in Python, as part of a Bachelor's degree in Material Sciences at the University of Algiers. It covers the history of computing, definitions of computers and programs, the importance of algorithms, and the basic components of computer systems. The course aims to provide foundational knowledge in computer science, including the evolution of computing technologies and the role of algorithms in problem-solving.

Uploaded by

boostube123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

People's Democratic Republic of Algeria

Ministry of Higher Education and Scientific Research


UUniversity of Algiers 1 Benyoucef Benkhedda
Faculty of Sciences
Department of Materials Science

Bachelor's Degree Course 1 (Semester 1).

Computer Science 1

Field: Material Sciences.

Email: a_boudjidj@[Link] Teacher: Mr. [Link]


[Link]@[Link]
Course: computer science 1

Introduction to Algorithmic Thinking


and Control Structures in Python
Chapter 1: Introduction to Computer Science and Algorithms

1- Brief history of computing

2- What is a computer and a program

3-Introduction to algorithms and their importance

4- Different parts of an algorithm

5-The concept of programming languages and algorithmic languages


Introduction

For centuries, humans have created and used various means and tools of calculation to improve the speed and accuracy of numerical

calculations. However, it was in the 20th century after World War II that a great technological advance was made in the field of

electronics, paving the way for the creation of programmable electronic machines (later called computers) and the birth of computer

science.

Computer science is currently undergoing an extremely rapid evolution, due to the miniaturization and reduction of production costs

of electronic components and the intensive development of programs and software for various applications. It can be seen that

computer science is now everywhere. In a few years, this technique has established itself in all areas without exception

(administration, industry, economy, medicine, games and leisure, in households, ...).

1
1- Brief history of computing

Figure 2 :Slide rule


Figure 1: Abacus
Invented in 1625, It was used by many
Invented in China a few centuries before Christ, engineers until the appearance of
was the first mechanical calculating instrument. electronic calculators in the mid-1970s.

2
1- Brief history of computing

Figure 3 First mechanical calculators

In 1642, Blaise Pascal invented the first Figure 4: First programmable machines (Generated by IA)
mechanical calculator .(Generated by IA) In 1833, Charles Babbage imagined and
- In 1801, Joseph-Marie Jacquard
invented a system for programming a attempted to build a programmable analytical

loom using a series of punched cards. machine (with a calculation unit, memory,

(Generated by IA) register, and input of data by punched card).

3
1- Brief history of computing
1.1 Generations of Computers
The computers have been classified into generations based on the technologies used for storage and processing of
information (memory and processors). The following table presents this classification as follows.

Generation Period Technologies Used


1 1938-1945 Electromechanical
relays
2 1945-1956 Vacuum tubes
3 1956-1963 Transistors
4 1963-1971 Integrated circuits
5 1971- Present Microprocessors

Table 01: Camputer generations


4
1- Brief history of computing

5
1- Brief history of computing

6
2- What is a computer and a program
2.1 Computer Science
Definition of Computer science proposed by the French Academy in 1966: is the science of rational processing, particularly by
automatic machines, of information considered as the support of human knowledge and communication in technical, economic,
and social fields.
It allows for the manipulation, management, organization, and storage of information. It is a field in perpetual evolution, due to
the progress of electronics and the evolution of software and programming techniques.

2.2 Computer
A computer is an automatic information processing machine (in binary form) under the control of recorded programs. It can:
Acquire and store information, perform data processing received as input, And output it in another form. Different types of data
processed include texts, images, sounds, numbers, etc
A computer system consists of two parts:
- hardware: the computer and its peripherals
- software: a set of programs and data (stored on the hard drive)

7
2- What is a computer and a program
A-Conversion from base 10 to base 2 B- Conversion from base 2 to base 10

From B=10 to B=2 To pass from base 2 to base 10 where


Example X= 115 10 We consider the following number : N= 1011 2 , the number N
X= ? 2 is written in binary b=2

X= 1110011 2
𝒂𝟑 𝒂𝟐 𝒂𝟏 𝒂𝟎
1 0 1 1

3 2 1 O 𝒊 Weight of numbers
Result = 0, so Stop
So to write N in Decimal (b=10) as follows:
𝑁 = 1 ∗ 23 + 0 ∗ 22 + 1 ∗ 21 + 1 ∗ 20
𝑁 = 8 + 0 + 2 + 1 = 11
N= 1011 2 = 11 10

X= 115 10 = 1110011 2

8
2- What is a computer and a program
C- Vocabulary and computing units D-Units of Calculation
Bit
A bit is the smallest unit of binary information (a physical object
with two states represents one bit). It is the basic element for the ❖ Byte: 1 byte = 8 bits
representation of information. (0 or 1)
❖ Kilobyte (KB): 1 kilobyte (KB) = 1024 (210 ) bytes
Instruction
A line of text containing an operation code and one or more ❖ Megabyte (MB): 1 megabyte (MB) = 1024 KB = (210 ) KB
references to operands.
❖ Gigabyte (GB): 1 gigabyte (GB) = 1024 MB = (210 ) MB
Byte (octet)
A byte is the primary unit of calculation for computer storage ❖ Terabyte (TB): 1 terabyte (TB) = 1024 GB = (210 )GB

capacity. An octet is an information unit composed of 8 bits.


1 byte (octet) = 8 bits.
Word
A word is a group of bits considered as a single indivisible unit. The
size of a word is often used to classify processors (8 bits, 16 bits, 32
bits, 64 bits, etc.). A processor is faster if it can process longer
words. 9
2- What is a computer and a program
2.1 Hardware (or physical) part
This is the set of modular electronic components (one component can be replaced by another in order to improve the performance of the
computer).Computer hardware components are divided into two main categories:
1- internal components
Internal components are the parts of the computer that are always placed inside the central processing unit (case) and more precisely on
the motherboard.
2- Peripherals
are the parts of the computer that are usually placed outside the case but which sometimes can be placed inside the case. For example,
even though the hard drive is often placed inside the case, it is considered a peripheral since it is possible to get an external hard drive
that works outside the case.

2.2 Software part


It is a set of programs ensuring the management and control of the hardware part of the computer. It's the operating system and these
applications.

10
2- What is a computer and a program 3
Hardware
4 2
1 – Monitor

2 - Motherboard 5

3 – Processor
7 1
4 - Connectors 6

5 - RAM
11
6 - Expansion card 8

7 - Power supply
9
8 - CD player 10

9 - hard drive

10 - keyboard
12
11 - Mouse

12 - Printer Figure 5: Computer and its peripherals 11


2- What is a computer and a program
2.3 Types of computers

4.3.1 Personal computers


Desktop computers, consisting of a chassis containing a motherboard and allowing
for the connection of various peripherals such as the monitor.
Laptops or notebooks, consisting of a case with a foldable screen, a keyboard, and
a large number of built-in peripherals.
Figure 6: Laptop and desktop computer

2.3.2 Smartphone or intelligent phone


is an advanced mobile phone with the functions of a personal digital
assistant, a digital camera, and a laptop computer. Data entry is usually
done through a touch screen or, less commonly, a keyboard or stylus
Figure 7: PC tablet
Figure 8
Smartphones

12
2- What is a computer and a program

2.3.3 Mainframe computer


En Mainframes are computers with high
computing power, huge input-output capacities,
and a high level of reliability. They are used in
large companies to perform heavy calculations or
process large amounts of data. Mainframes are
usually used in centralized architectures, of which
they are the core.

Figure 9: Mainframe IBM

13
2- What is a computer and a program

2.4.1 Program
A computer program is a precise, ordered set of instructions, combined with data definitions, that enables computer hardware to perform
specific computational or control tasks. It includes the instructions themselves (often written in some programming language), the
necessary control flow, and the definitions of data used, so that the processor can execute them step by step and reach the intended
outcome.

2.4.2 Definition of software


Software constitutes the set of programs necessary for the operation of a computer system. It is therefore a more or less complex set of
instructions (source code) written in a programming language by programmers. This code is then translated into machine language
(binary); it is an essential part for the operation of a machine (computer, telephone, tablet, etc.). We distinguish two types of software
(diagram 1):
1- Basic software : operating systems,
2- Application software: word processing, games, video, etc.

14
2- What is a computer and a program

2.4.3 Definition of the Operating System


The Operating System (OS) is the basic software of the machine, it is a set of programs responsible for the
connection between the hardware resources of a computer (Hardware) and the user's applications Software (word
processing, video games, etc).
The OS supports all the hardware components of a computer (processor, memory, hard drive, peripherals, etc.)
It allows to :
✓ Ensure computer boots
✓ Run programs or software (drawing, word processing, etc.) by the user
✓ Manage access to peripherals (screen displays, printer output, etc.)
✓ Facilitate the user's work thanks to its graphical interface,

15
2- What is a computer and a program
Software

2
1

16
3-Introduction to algorithms and their importance

You decide to mix the


ingredients randomly until
achieving the desired result.

• How many attempts will it take you?

Number of Attempts: This process might take thousands of attempts or even more.
Uncertain Outcome: There is no guarantee that you will achieve the desired result despite numerous efforts.
Resource Consumption: This trial-and-error approach demands a significant amount of ingredients.
Time Investment: It also consumes a considerable amount of time to achieve even a semblance of success.
17
3-Introduction to algorithms and their importance

But, if you have the recipe, you will prepare it in a few minutes

Algorithms are just a recipe

18
3-Introduction to algorithms and their importance
Examples
1- Searching for a phone number
Problem: You need to find a contact in a sorted phone directory.
Algorithm: Binary Search (keep dividing the list in half until you find the number).
Benefit: Much faster than checking line by line.

2- Finding the shortest route on Google Maps


Problem: How to drive from City A to City B using the fastest route.
Algorithm: finds the shortest path in a graph (maps).
Benefit: Optimizes travel time.

3- Password Verification
Problem: Check if the entered password matches the stored one.
Algorithm: Comparing the entered password with your stored password to make sure that you are the owner of the account.
Benefit: Secure comparison without storing the real password.
19
3-Introduction to algorithms and their importance
« An algorithm is a systematic set of steps or instructions designed to solve a problem
or achieve a specific goal. »

Algorithms What It come from ?

The story : Algorithm - ‫خوارزمية‬

20
3-Introduction to algorithms and their importance
History of Algorithms

Part 1: The Beginning

It all began in Baghdad in the 9th century when Muhamad ben

Moussa al-Khwarizmi posed a groundbreaking question: 'What if

mathematics is not just the geometry of squares, circles, and

calculations?' He then embarked on a new scientific journey

named ‘El Djaber’.

In the 11th century, his books reached Europe and were translated.

The scholars of that time were astonished by these mathematical Muhammad ben Moussa al-Khwarizmi
thoughts. They named the method of using el Djaber to find a

solution and its instructions 'Algorithm’.

21
3-Introduction to algorithms and their importance
History of Algorithms
Part 2: From Arithmetic to Computing
Following the first part, this science was named 'Algorithmics’. For

centuries, it remained a theoretical concept in books.

In the 19th century, a woman named ‘Ada Lovelace’ revitalized the field

with a new theory. She was the first to recognize that machines could serve

purposes beyond counting and arithmetic. Lovelace published the first

executable algorithm on a mechanical computer of that era, marking the

inception of practical algorithmic applications. She was a pioneer in

envisioning computers as problem-solving tools, making her the first

figure in the history of algorithms.


Ada Lovelace

22
3-Introduction to algorithms and their importance
History of Algorithms
Part 3: The Modern Era
Research in algorithmic science persisted with
figures like Edward Hopper, focusing on solving
the decision problem until the 1930s. It was during
this time that a genius emerged, laying the
foundations for the algorithms used in contemporary
computers. Inventing the Turing machine, Alain
Turing provided a model for what we now recognize
as a computer. Turing's work is considered
foundational in the realm of artificial intelligence,
Alain Turing
shaping the modern concept of algorithms. Today,
artificial intelligence stands as the pinnacle and most
comprehensive form of algorithms. 23
3-Introduction to algorithms and their importance
Définition Algorithms

✓ Recipe
✓ Moring routine : Exercice shawer breakfast
✓ Driving directions you follow to get to
destination
An algorithm is a systematic set of steps or
instructions designed to solve a problem or
achieve a specific goal.

Example 1

Picture : simple maze


24
3-Introduction to algorithms and their importance

Définition Algorithms

Example 2 Picture : simple maze with multiple solutions


1- Gess a number between 1 and 10
2- This time 1 to 100
25
4- Different parts of an algorithm

Parts of an Algorithm (Input – Process – Output)


Every algorithm follows 3 main steps

2 Process

Input Output
1 3

1- **Input**: Data provided to the algorithm (from user, file, etc.).


2- **Process**: Operations or calculations on the data.
3- **Output**: The final result displayed or stored.

26
4- Different parts of an algorithm
The general syntax of an algorithm
declaration
Algorithm « Name of the algorithm »; Concept of variable
A- A header part, also called Constants
Constants P=13.4; prototype array
Fonction
Variables
Procedure
Keywords :
Variable1: Integer;
Variable 2: real;
Algorithm
Variables
Begin
//The instruction set B- The body of the algorithm. Constants
….. Instructions Read
End. Assignment
Read: Read(variable)
write
Write: Write (variable, value, or Begin
expressions) End
An algorithm is a text composed of two parts:

27
5-The concept of programming languages and algorithmic languages
Algorithm « hello»
Coding Python code (programming language)
Begin
Write (“Hello everyone”);
print ("Hello everyone")

End.

The general syntax of an algorithm


Hello everyone

Algorithmic Language Programming Language

28
5-The concept of programming languages and algorithmic languages
Définitions
Algorithm

An algorithm is a systematic set of steps or instructions to solve a problem or achieve


a goal.

A programming language

In computer science, a programming language is a conventional notation intended to


formulate algorithms and produce computer programs that apply them

A software

Is a set of programs or a sequence of instructions written by a machine-interpretable


programming language
Examples of software:
➢ Word Excel…
➢ Facebook Instagram….
➢ Google YouTube…. 29
5-The concept of programming languages and algorithmic languages
Software development process

Transform the
Write an As an output
algorithm into a
we would
Problem algorithm to programming
have a
analysis solve the language for the
program that
problem machine to
works
interpret

30
5-The concept of programming languages and algorithmic languages
Software development process

A programming language
A software
Algorithm

31
5-The concept of programming languages and algorithmic languages
Programming Languages: High-Level vs. Low-Level

Table : High-Level vs. Low-Level

Type Description Examples


Low-Level Closer to machine, fast but hard to read Assembly, Machine code
High-Level Human-friendly, easy to write and maintain Python, Java, C++

****High-level languages use compilers or interpreters to translate code to machine language.****

Algorithmic Language → conceptual or pseudocode form.


Programming Language → formal code for execution.

32
Conclusion

In this chapter, we discovered the fundamental concepts of computer science, including what a computer
is and how programs work to solve real-world problems. We learned that algorithms are the foundation of
every program, providing clear and logical steps to reach a desired outcome. Finally, we explored the
difference between algorithmic thinking and programming languages, understanding that while
algorithms describe the logic, programming languages are the tools that allow us to translate this logic
into instructions a computer can execute.

33

You might also like