Upload
alexina-james
View
230
Download
0
Tags:
Embed Size (px)
Citation preview
CSS106 Introduction to Elementary
AlgorithmsM.Sc Askar Satabaldiyev
What is an “algorithm”?
algorithm(noun):a set of steps
to accomplish a task
•Go to bus station
•Go to bus station• Take a bus
•Go to bus station• Take a bus•Go to university
•Go to bus station• Take a bus•Go to university (!)
• Slice bread
• Slice bread•Apply cheese
• Slice bread•Apply cheese•Get your cheese toast
Computer Science algorithms
Start with an input data
Start with an input data
Do complex calculations
Start with an input data
Do complex calculations
Stop when we find answer
Computer Science
a few examples…
Compression algorithms
Finding optimal route algorithms
rendering algorithms
Optimization and scheduling algorithms
Which algorithms will you use?
Make your programs
FASTER
Which algorithms could you CREATE?
Big Data Analysis
What makes a good algorithm?
What makes a good algorithm?
1. Correctness
2. Efficiency
Asymptotic Analysis
#nodes Nearest insertion
Brute force
1 1 1
2 4 1
3 9 2
4 16 6
…
25 625 620448401733239439360000
N2 N!
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?
Grading Policy
Attendance 10%Midterm Exam 20%Assignment 15%Homework 15%Quizes 10%Final Exam 30%Contests/Codeforces/Bonus 20%Total 100%(+20?)
Grading Policy
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