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

algo1

Uploaded by

abdolakamora2006
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)
12 views

algo1

Uploaded by

abdolakamora2006
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
You are on page 1/ 5

Badji Mokhtar Annaba university – Computer Science Department

Bachelor Of Computer Science - First Year - S1 - 2024 / 2025


Algorithms and Data Structures 1

Chapter 1 : Introduction

1. Computer Science

1.1. Brief introduction


Computer science is a captivating and transformative field that lies at the intersection of
technology, mathematics, logic, and creativity. It is a discipline that has reshaped the way we
live, work, and interact with the world.
The story of computer science begins long before the advent of the modern computer. It can
be traced back to the ancient Greeks, who explored mathematical concepts and logic. However,
it was the 19th and 20th centuries that saw pivotal advancements. Figures like Ada Lovelace,
often regarded as the world's first computer programmer, and Alan Turing, a pioneer in
theoretical computer science, laid the groundwork for what would become a revolutionary field.
The mid-20th century marked a turning point with the creation of the first electronic
computers. The ENIAC (Electronic Numerical Integrator and Computer), developed during
World War II, was a colossal machine that could perform complex calculations at speeds
previously thought impossible. This technological leap paved the way for a new era, where
machines could be programmed to execute a wide range of tasks.
Computer science, at its core, is the systematic study of computation, information
processing, and the design of algorithms to solve problems. It encompasses a diverse array of
topics and subfields, including:
1. Algorithms: Algorithms are precise, step-by-step instructions for solving specific
problems. They are the building blocks of software, driving everything from web
searches to autonomous vehicles.
2. Data Structures: Computer scientists work with data in various forms, and data
structures provide the means to organize and manage this data efficiently. Arrays, linked
lists, and trees are just a few examples.
3. Programming: Programming languages serve as the means of communication between
humans and computers. Languages like Python, Java, and C++ allow programmers to
write code that computers can understand and execute.
4. Computer Systems: Understanding the hardware and software components of
computer systems is crucial. Topics include computer architecture, operating systems,
and networking.
5. Artificial Intelligence (AI): AI is a dynamic field within computer science that aims to
create machines capable of human-like intelligence, such as learning, reasoning, and
problem-solving.

1
Badji Mokhtar Annaba university – Computer Science Department
Bachelor Of Computer Science - First Year - S1 - 2024 / 2025
Algorithms and Data Structures 1
6. Databases: Databases are essential for storing and retrieving vast amounts of structured
data, driving applications like e-commerce, social media, and healthcare.

1.2.The ubiquity of computer science


Computer science is not confined to academic settings or research laboratories; it permeates
nearly every aspect of our lives. It underpins the technologies we rely on daily:
1. Communication: The internet and mobile devices have transformed how we connect
with others, access information, and conduct business, all powered by computer science.
2. Healthcare: Computer algorithms aid in medical diagnosis, drug discovery, and the
management of patient records, improving healthcare outcomes.
3. Transportation: Self-driving cars, GPS navigation, and traffic optimization are just a
few examples of how computer science is revolutionizing transportation.
4. Entertainment: The gaming industry, augmented and virtual reality, and digital content
creation all owe their existence to computer science innovations.
5. Finance: High-frequency trading, risk assessment, and fraud detection rely heavily on
algorithms and data analysis, shaping the world of finance.

1.3.The promise of computer science


As we look to the future, computer science remains a boundless frontier of discovery and
innovation. It offers solutions to complex global challenges, from climate modeling and
renewable energy optimization to space exploration and healthcare breakthroughs.
Moreover, computer science empowers individuals, bridging the gap between imagination and
reality. It provides a toolkit for solving problems, creating applications, and shaping the future.
Whether you aspire to become a software developer, data scientist, cybersecurity expert, or AI
researcher, computer science offers a diverse and exciting array of career paths.
In conclusion, computer science is not merely a field of study; it is a dynamic force that
continues to redefine our world. It embodies the human spirit of curiosity, exploration, and
problem-solving. By understanding and harnessing the principles of computer science, we
unlock the potential to shape a brighter, more technologically advanced future for generations
to come.

2. Algorithms
2.1.The genesis of algorithms
Early civilizations like the Egyptians and Babylonians developed numerical systems and simple
algorithms for arithmetic calculations. The Greeks, notably Euclid, laid the groundwork for
algorithmic thinking in geometry.
The first person to systematically develop algorithms was the Persian mathematician Al-
Khwârizmî ( ,)‫محمد بن موسى الخوارزمي‬active between 813 and 833. In his work titled 'The

2
Badji Mokhtar Annaba university – Computer Science Department
Bachelor Of Computer Science - First Year - S1 - 2024 / 2025
Algorithms and Data Structures 1
Compendious Book on Calculation by Completion and Balancing' , he studied all second-
degree equations and provided their solutions through general algorithms.
As we transition to the Renaissance period, we encounter luminaries like Leonardo da Vinci,
who employed algorithmic methods in art and engineering. However, it was not until the 17th
century that calculators and mechanical devices, such as Pascal's Pascaline and Leibniz's
stepped reckoner, brought algorithms into practical use.
The 19th century witnessed the advent of Charles Babbage's Analytical Engine, often
considered the precursor to modern computers. Ada Lovelace, the world's first computer
programmer, collaborated with Babbage and wrote algorithms for the engine. His work
foreshadowed the role of algorithms in future computing.

2.2. Algorithms
An algorithm for a particular task can be defined as “a finite sequence of instructions, each of
which has a clear meaning and can be performed with a finite amount of effort in a finite
length of time”. As such, an algorithm must be precise enough to be understood by human
beings. However, in order to be executed by a computer, we will generally need a program
that is written in a rigorous formal language; and since computers are quite inflexible
compared to the human mind, programs usually need to contain more details than algorithms.
Algorithms are systematic sets of instructions used to solve specific problems. They serve as
the intellectual building blocks of computer science, enabling computers to perform tasks
ranging from sorting data to playing chess.
2.3. Algorithmic Paradigms
Divide and Conquer: One of the fundamental algorithmic paradigms, divide and conquer,
breaks down complex problems into simpler subproblems, solving each recursively. Examples
include merge sort and quicksort.
Dynamic Programming: Dynamic programming involves breaking down a problem into
smaller overlapping subproblems and solving each only once, storing the results for future
reference. Classic examples are the Fibonacci sequence and the Knapsack problem.
Greedy Algorithms: Greedy algorithms make locally optimal choices at each step, aiming to
find a globally optimal solution. Huffman coding and Dijkstra's algorithm are well-known
instances of this approach.

2.4.Algorithms in the Modern World


In the Digital Age: With the advent of electronic computers in the mid-20th century, algorithms
became the lifeblood of computing. From data sorting and searching to cryptography and
artificial intelligence, algorithms shape the digital landscape.
Practical Applications: Algorithms permeate various domains, including finance, healthcare,
transportation, and entertainment. They drive recommendation systems, autonomous vehicles,
genome sequencing, and much more.

3
Badji Mokhtar Annaba university – Computer Science Department
Bachelor Of Computer Science - First Year - S1 - 2024 / 2025
Algorithms and Data Structures 1
The Future of Algorithms
Quantum Computing: The future holds exciting prospects with the emergence of quantum
computing. Quantum algorithms promise to revolutionize fields like cryptography,
optimization, and materials science.
Ethical Considerations: As algorithms become increasingly integrated into our lives, ethical
questions arise concerning their use in surveillance, decision-making, and bias.

3. Von Neumann architecture


breaks down the computer into four parts distinct:
 the arithmetic and logic unit that performs basic operations;
 the control unit, responsible for “sequencing” operations;
 the memory which contains both the data and the program which will indicate to the
unit control what calculations to perform on this data. Memory divides in volatile
memory (programs and data during operation) and permanent memory (programs and
basic machine data);
 input-output devices (peripherals) to communicate with the outside world.

Algorithm Translation - Bridging Concepts to Code


Algorithm translation is the process of converting algorithmic solutions and logical problem-
solving steps into a specific programming language or code that a computer can understand
and execute.
Significance of Algorithm Translation- Execution : Algorithm translation is the bridge
between abstract problem-solving and practical implementation, enabling computers to carry
out tasks.
- Automation : Coded algorithms automate complex processes, saving time and effort
compared to manual solutions.

4
Badji Mokhtar Annaba university – Computer Science Department
Bachelor Of Computer Science - First Year - S1 - 2024 / 2025
Algorithms and Data Structures 1
- Reusability : Once translated into code, algorithms can be reused across different
applications, enhancing efficiency and consistency.
Strategies for Algorithm Translation- Pseudocode : Start by writing pseudocode, which is a
human-readable, high-level description of the algorithm's steps without worrying about
specific programming syntax.
- Choose a Programming Language : Select a programming language that suits the
problem's requirements and your familiarity. Common choices include Python, Java, C++,
and more.
- Step-by-Step Translation : Break down the algorithm into individual steps and translate
each step into the chosen programming language incrementally.
Techniques for Algorithm Translation
- Variable and Data Structure Selection : Choose appropriate variables and data structures
to represent and manipulate data within the algorithm. Ensure they align with the problem’s
requirements.
- Conditional Statements : Use conditional statements (if-else) to handle decision-making
within the algorithm.
- Loops : Implement loops (for, while) to handle repetitive tasks or iterations.
- Functions and Modularization : Divide the code into functions or modules to promote
code reusability and maintainability.

You might also like