37
CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Embed Size (px)

Citation preview

Page 1: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

CSS106 Introduction to Elementary

AlgorithmsM.Sc Askar Satabaldiyev

Page 2: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

What is an “algorithm”?

Page 3: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

algorithm(noun):a set of steps

to accomplish a task

Page 4: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

•Go to bus station

Page 5: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

•Go to bus station• Take a bus

Page 6: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

•Go to bus station• Take a bus•Go to university

Page 7: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

•Go to bus station• Take a bus•Go to university (!)

Page 8: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

• Slice bread

Page 9: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

• Slice bread•Apply cheese

Page 10: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

• Slice bread•Apply cheese•Get your cheese toast

Page 11: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Computer Science algorithms

Page 12: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Start with an input data

Page 13: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Start with an input data

Do complex calculations

Page 14: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Start with an input data

Do complex calculations

Stop when we find answer

Page 15: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Computer Science

Page 16: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

a few examples…

Page 17: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 18: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Compression algorithms

Page 19: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Finding optimal route algorithms

Page 20: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

rendering algorithms

Page 21: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Optimization and scheduling algorithms

Page 22: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Which algorithms will you use?

Page 23: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Make your programs

FASTER

Page 24: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 25: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 26: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Which algorithms could you CREATE?

Page 27: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 28: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 29: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Big Data Analysis

Page 30: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

What makes a good algorithm?

Page 31: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

What makes a good algorithm?

1. Correctness

2. Efficiency

Page 32: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev
Page 33: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Asymptotic Analysis

#nodes Nearest insertion

Brute force

1 1 1

2 4 1

3 9 2

4 16 6

25 625 620448401733239439360000

N2 N!

Page 34: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

k = 0;for (i = 1; i <= N; i++) if (N % i == 0) k++;

return k == 2;

for (i = 2; i < n; i++) if(N % i == 0) return false;return true;

another method…

for (i = 2; i < sqrt(n); i++) if(N % i == 0) return false;return true;

Which one is faster?

Page 35: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Grading Policy

Page 36: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Attendance 10%Midterm Exam 20%Assignment 15%Homework 15%Quizes 10%Final Exam 30%Contests/Codeforces/Bonus 20%Total 100%(+20?)

Grading Policy

Page 37: CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev

Intro to algorithms 01.Sept – 04.SeptBinary Search/Asymptotic notations

07.Sept – 11.Sept

Selection sort/Insertion sort 15.Sept – 18.SeptRecursive algorithms 22.Sept – 25.SeptTowers of Hanoi/Merge Sort/Quick sort

29.Sept – 02.OctGraph Representation 05.Oct – 09.OctBreadth-first search 12.Oct – 16.OctMidterm Exam 19.Oct – 23.Oct

Upcoming Topics