Lecture 1
Lecture 1
Instructors:
Dr. Muhammad Yusuf
Baffa Sani
Bilal Lawal Alhassan
Faruk Yusha’u
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 de-
termines 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
2.2 Computer Algorithms
A computer algorithm is a step-by-step procedure or set of rules designed to solve a
specific problem or perform a particular task, implemented for execution on a computer.
It provides a systematic approach to writing computer programs and is crucial for software
development. Here are five examples of computer algorithms:
4. PageRank Algorithm: Used by search engines to rank web pages in their search
results.
3 Characteristics of an Algorithm
Before delving into the importance of efficient algorithms, let’s review the key character-
istics that define an algorithm:
1. 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.
2
4.1.1 Aposteriori Analysis
Aposteriori analysis involves implementing the algorithm and then measuring the time
taken by the system to successfully execute the program. Practical considerations, such as
the speed of the computer, the programming language used, the compiler or interpreter,
and the skill of the programmers, can impact the actual running time.
1. Determining how long the algorithm takes, represented as a function of the size of
the input, denoted as f (n) where n is the size of the input.
2. Analyzing the growth rate of the running time function with respect to the input
size, known as the running time growth rate.
Algorithms are compared based on their running time growth rates, with those exhibiting
lower growth rates considered more favorable. This approach allows for a proactive as-
sessment of an algorithm’s efficiency before practical implementation, taking into account
the algorithm’s characteristics and its anticipated performance across varying input sizes.
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.
Computer B (Slower):
3
6 Conclusion
This example highlights the critical importance of choosing algorithms with slower rates
of growth. Despite the faster processing power of Computer A, the inefficiency of its
algorithm resulted in a significantly longer execution time compared to Computer B.
This underscores the profound impact that algorithm selection has on overall system
performance and efficiency.