Introduction to Algorithms
Introduction to Algorithms
1 Introduction
Algorithms are fundamental to maximizing the benefits of advanced computer hardware. Just like having
the latest and most powerful processors, the efficiency of algorithms determines the overall performance
and effectiveness of computational tasks. In this lesson, we will explore the significance of implementing
efficient algorithms, using a practical example to illustrate their impact on computing systems.
2 Definitions
2.1 Algorithms in General
An algorithm is a step-by-step procedure or set of rules designed to solve a specific problem or perform
a particular task. It provides a systematic approach to problem-solving and is applicable across various
fields. Here are two examples of algorithms in general:
1) Algorithm: Making a Cup of Tea
a) Add water to the kettle
b) Boil it
c) Add tea leaves
d) Add Milk
e) Add sugar
2) Algorithm: Withdrawing Money from an ATM
a) Insert the card
b) Enter the PIN
c) Enter the amount
d) Withdraw amount
e) Check balance
f) Cancel/clear
1
3 Characteristics of an Algorithm
Before delving into the importance of efficient algorithms, let’s review the key characteristics that define
an algorithm:
a) Input and Output: An algorithm must take input and produce some output, which could be in
the form of true/false, a specific value, etc.
5 Practical Example
Consider two computers: computer A, which is faster and executes 10 billion instructions per second,
and computer B, which is slower, running at 10 million instructions per second. Both computers are
tasked with sorting an array of 10 million numbers.
2
5.1 Algorithm Analysis
◦ Computer A (Faster):
6 Conclusion
The example highlights the critical importance of choosing algorithms with slower rates of growth.
Despite the significant discrepancy in raw computing power, the efficiency of the algorithm used by
computer B significantly outperforms computer A. This underscores the profound impact that algorithm
selection has on overall system performance and efficiency.