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

Intro To Algorithms

This document provides an introduction and overview of an algorithms course. It outlines the course description, pre-requisites, objectives, topics to be covered, and assessment plan. The course aims to familiarize students with existing algorithms and equip them with tools and techniques for solving problems. Major topics include sorting, searching, recursion, graphs, and complexity analysis. The origin of the word "algorithm" is also discussed, tracing it back to the 9th century mathematician al-Khwarizmi.

Uploaded by

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

Intro To Algorithms

This document provides an introduction and overview of an algorithms course. It outlines the course description, pre-requisites, objectives, topics to be covered, and assessment plan. The course aims to familiarize students with existing algorithms and equip them with tools and techniques for solving problems. Major topics include sorting, searching, recursion, graphs, and complexity analysis. The origin of the word "algorithm" is also discussed, tracing it back to the 9th century mathematician al-Khwarizmi.

Uploaded by

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

Introduction to

Algorithms
Muzaffar Iqbal Farooqi
Assistant Professor
Department of Computer Science
COMSATS University Islamabad

1
Course Description

2
Course Description…

3
Pre-Requirements
• Basic understanding of mathematics (must)
• Basic understanding of programming (must)
• Data Structures (recommended)
• Object Oriented Programming (recommended)
• Discrete Structures (recommended)

4
Course Objectives
• The course has two basic objectives.
1. Familiarize students with existing algorithms
2. To equip the students with the necessary tools, techniques,
and confidence required in solving a non- textbook problem

• Design of algorithm is essentially a creative effort containing all


the ingredients of a thriller: adventure, excitement, challenge,
and suspense.

5
Recommended Books
1. Introduction to the Design and Analysis of Algorithms,
Levitin, A., 3rd Edition (2012), Pearson.
2. Introduction to Algorithms, Cormen, T. H.,Leiserson, C.E.,
Rivest, R.L.& Stein, C., 3rd Edition
(2009), MIT Press.
3. An Introduction to the Analysis of Algorithms, Sedgewick,
R.& Flajolet, P., 2nd Edition (2012),
Addison-Wesley.
4. Foundation of Algorithms Using C++ Pseudocode,
Neapolitian, R., 6th Edition (2013), Jones &
Bartlett Learning .
6
Assessment Plan

7
Major Topics To Be Covered
• The concept and properties of algorithms
• Fundamentals of algorithmic problem solving
• Brute-Force Algorithms
• Asymptotic Notation
• Different algorithms of sorting
• Different algorithms of searching
• The Iteration and Recursion Methods
• Greedy Algorithms
• Graphs
• Heuristics
8
Origin of word: Algorithm
• The word Algorithm comes from the
name of the muslim author Abu Ja’far
Mohammad ibn Musa al-Khowarizmi.
• He was born in the eighth century at
Khwarizm (Uzbekistan)
• Originally, the word algorism was
used for the rules for performing
arithmetic using decimal notation.
• Much of al-Khwarizmi’s work was
written in a book titled al Kitab al-
mukhatasar fi hisab al-jabrwa’l-
muqabalah 9
Origin of word: Algorithm …
• Al-Khowarizmi wrote a paper in 825 AD, on calculation with
Hindu Numerals.
• It was translated into Latin in the 12th century as Algoritmi de
numero Indorum (al-Daffa 1977), which title was likely
intended to mean "Algoritmi on the numbers of the Indians“.
• It is from the titles of his writings and his name that the words
algebra and algorithm are derived.
• Al-Khwarizmi is regarded as the most outstanding
mathematician of his time

10
Algorithm: Informal Definition
• An algorithm is any well-defined (computational) procedure
that …
• takes some values, or set of values, as input
• produces some value, or set of values, as output
• An algorithm is thus a sequence of computational steps that
transforms the input into output.

11
Algorithms: Informal Introduction
Recipe for baking a cake….
Ingredients: Input
2 sticks butter
2 cups flour
1 cup sugar
4 eggs
1 cup milk
1 tsp baking powder
Cocoa powder (1/2 pound)
Procedure: Method
Mix the sugar, baking powder and flour, mix in beaten
eggs, melted butter and bake at 325F for 40 mins.
Result: Output
What is algorithm?
• What is binary equivalent of decimal integer 75?
• 1001011
• How can we convert this number into its binary
equivalent?
• We have a procedure for this.
• Let us see how we can convert 75 into binary

13
Convert 75 to binary

2 75 remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1

1001011
Procedure for Decimal to Binary conversion
1. Write the decimal number

2. Divide by 2; write quotient and remainder

3. Repeat step 2 on the quotient; keep on repeating until the


quotient becomes zero

4. Write all remainder digits in the reverse order (last remainder


first) to form the final result

• What is it?
• A procedural solution to given problem
• Briefly speaking, algorithms are procedural solutions to
problems
• Algorithms are not answers, but rather precisely defined
procedures for getting answers. (e.g., sorting 3 numbers)
What is Algorithm?
• Algorithm is a well defined computational procedure
that takes some value, or set of values (collection of
elements) as input and produces some value, or set
of values(collection of elements) as output.

• A computer algorithm is a detailed step-by-step


method for solving a problem by using a computer.
What is Algorithm?

• An algorithm is a sequence of unambiguous instructions for


solving a computational problem, i.e., for obtaining a
required output for any legitimate input in a finite amount of
time.

17-Sep-19
problem

algorithm

input “computer” output

17
Example: Largest integer among five integer

Is there a
relationship
between input
and output?
Defining actions in FindLargest algorithm

L
o
g
i
c

Algorithm= Data + Logic


Algorithms and Programming

20
Why Study Algorithms?
• This course is all about …
• What are the established well known algorithms?
• How to design good algorithms?
• This is not really an independent issue.
• Designing good/efficient algorithms requires understanding of some
other areas.
• The fact is that many of the courses in computer science deal with
efficient algorithms and data structures.
• These are applied to various applications like…
• Compilers
• Operating Systems
• Databases
• Artificial Intelligence
• Computer Graphics 21
• Networks and many more
Why Study Algorithms…
• A good understanding of algorithm design is central element
to a good understanding of computer science and computer
programming.
• Another reason for studying algorithms is their usefulness in
developing analytical skills. After all, algorithms can be seen as
special kinds of solutions to problems

22
Brief Course Outline
• This course will broadly consist of the following major
sections.
1. Sorting… this will focus on different established algorithms
for sorting and use this problem as a case study to
understand different techniques.
2. Collection of different algorithmic problems and solution
techniques: dynamic programming, greedy strategy, graphs
etc.
3. Theory of NP-completeness. NP-complete problems are
those for which no efficient algorithms are known. Even no
one may know it for sure that efficient solutions might exist.
23
QUESTIONS
?
24

You might also like