Lecture 0
Welcome!
Class Information
• Course materials and updates will be
posted in Google Classroom
• Online lectures will be delivered via
Google Meet
• You are expected to attend the
sessions right on time
• Attendance: Enter your name and
student ID in the chat box
Introduction 2
Class Information
• For any course-related query, feel
free to send an email at:
[email protected]
• For calls or text messages, CR
should communicate with me via
Mobile/WhatsApp
Introduction 3
Course Information
Course Title: Algorithm
Course Code: CSE-2201
Credit: 3.00
Contact 3 Hrs./Week
Hours:
Total Marks: 100
Introduction 4
Prerequisites
• CSE 1201 (Programming)
• CSE 2103 (Data Structure)
• CSE 2105 (Discrete Mathematics)
Introduction 5
Resources
Textbooks:
✓ ‘Introduction to Algorithms’ (3rd Edition)
by Cormen, Leiserson, Rivest and Stein
✓ ‘Fundamentals of Computer
Algorithms’ by Horowitz, Sahni,
Rajasekaran
Recommended Online Reads:
✓ https://www.tutorialspoint.com/design_an
d_analysis_of_algorithms/index.htm
Introduction 6
Evaluation
Sl Marks
Description
No. distribution
1 Mid-term examination 30
2 Assignments/Viva 10
3 Attendance 10
4 Final term examination 50
Total 100
Introduction 7
Evaluation (Lab)
Sl Marks
Description
No. distribution
1 Assignments (3-4) 50-80%
2 Viva/Quiz 10%
3 Attendance 10%
4 Final Evaluation 0-30%
Total 100
Introduction 8
Why this Course?
“কী দরকার এসব
পড়াশ ানার?”
Introduction 9
Why this Course?
• Algorithms are fundamental to all areas of CS
• Algorithms help to build efficient programs
Introduction 10
Tips for Doing Well in the Course
✓ Attend all classes
✓ Be active in class
✓ Discuss with your teacher
✓ Take effective notes
✓ Study constantly and in an organized way
Introduction 11
So What is an Algorithm?
• A process followed to solve a problem.
• An algorithm is any well-defined computational procedure that
takes some value, or set of values, as input and produces some
value, or set of values, as output. An algorithm is thus a
sequence of computational steps that transform the input into
the output.
Introduction 12
So What is an Algorithm?
Suppose you want to make a cup of tea.
• Inputs?
• Outputs?
Introduction 13
Inputs Output
https://simmertoslimmer.com/ginger-tea/ https://foodviva.com/tea-recipes/milk-tea-recip
Introduction 14
Inputs 1. Add a teabag to your Output
favorite cup.
2. Boil water and pour it
over the teabag.
3. Wait 3 to 5 minutes
for the tea to brew,
without stirring or
squeezing the teabag.
4. Remove the teabag
and pour in a dash of
https://simmertoslimmer.com/ginger-tea/ milk. https://foodviva.com/tea-recipes/milk-tea-recip
5. Stir with a spoon to
blend evenly.
এটাই অ্যালগররদম Introduction 15
So What is an Algorithm?
• Suppose we need to sort a sequence of numbers into nondecreasing
order. Here is how we formally define the sorting problem:
• For example, given the input sequence (31, 41, 59, 26, 41, 58), a
sorting algorithm returns as output the sequence (26, 31, 41, 41, 58,
59). Such an input sequence is called an instance of the sorting
problem.
Introduction 16
So What is an Algorithm?
By definition, something can only be called an algorithm if it has all of
the following properties.
1. Correctness: It must be correct. In other words, it must compute
the desired function, converting each input to the correct output.
2. Concrete steps: It is composed of a series of concrete steps.
3. No ambiguity: There can be no ambiguity
as to which step will be performed next.
1. Finiteness: It must be composed of a finite number of steps.
2. Termination: It must terminate. In other words, it may not go into
an infinite loop.
Introduction 17
Is there any
difference between
algorithm and
program?
Introduction 18
Program
• We often think of a computer program as an instance, or concrete
representation, of an algorithm in some programming
language.
• Algorithms are usually presented in terms of programs, or parts of
programs. Naturally, there are many programs that are instances of
the same algorithm, because any modern computer programming
language can be used to implement the same collection of algorithms
(although some programming languages can make life easier for the
programmer).
• To simplify presentation, people often use the terms "algorithm" and
"program" interchangeably, despite the fact that they are really
separate concepts. By definition, an algorithm must provide sufficient
detail that it can be converted into a program when needed.
Introduction 19
Summary
• A problem is a function or a mapping of inputs to outputs.
• An algorithm is a recipe for solving a problem whose steps are
concrete and unambiguous. Algorithms must be correct, of finite
length, and must terminate for all inputs.
• A program is an instantiation of an algorithm in a programming
language.
Introduction 20
Related Readings
➢ Introduction to Algorithms (3rd Ed.)
• Chapter 1
➢ Fundamentals of Computer Algorithms
• Chapter 1 (1.3.4)
➢ OpenDSA Website (opendsa-server.cs.vt.edu)
Introduction 21