Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
Faculty of Science for Women, University of Babylon, Iraq
By
Ass. Prof. Dr. Samaher Al_Janabi
LECTURE NOTES OF ALGORITHMS
DESIGN TECHNIQUES AND
ANALYSIS
Department of Computer Science The University of Babylon
22 February 2017
Why Study Algorithms?
• important for all other branches of computer science
• plays a key role in modern technological innovation– “Everyone knows Moore’s Law – a prediction made in 1965 by Intel co-
founder Gordon Moore that the density of transistors in integrated circuits would continue to double every 1 to 2 years….in many areas, performance gains due to improvements in algorithms have vastly exceeded even the dramatic performance gains due to increased processor speed.”• Excerpt from Report to the President and Congress: Designing a Digital Future,
December 2010 (page 71).
• provides novel “lens” on processes outside of computer
science and technology
– quantum mechanics, economic markets, evolution
• challenging (i.e., good for the brain!)
• fun
Dr. Samaher Hussein AliNotes of Lecture #1
22 February 2017
Course Objectives
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Algorithms are the heart of computer science, and the subject has
countless practical applications as well as intellectual depth. This specialization is
an introduction to algorithms for learners with at least a little programming
experience.
The specialization is rigorous but emphasizes the big picture and
conceptual understanding over low-level implementation and mathematical details.
After completing this specialization, you will be well-positioned to ace your
technical interviews and speak fluently about algorithms with other programmers
and computer scientists.
Specific topics in the course include: "Big-oh" notation, sorting and
searching, divide and conquer (master method, integer and matrix multiplication,
closest pair), randomized algorithms (QuickSort, contraction algorithm for min
cuts), data structures (heaps, balanced search trees, hash tables, bloom filters),
graph primitives (applications of BFS and DFS, connectivity, shortest paths).
Course DescriptionCourse Topics
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
• Vocabulary for design and analysis of algorithms
E.g., “Big-Oh” notation
“sweet spot” for high-level reasoning about algorithms
• Divide and conquer algorithm design paradigm
Will apply to: Integer multiplication, sorting, matrix
multiplication, closest pair
General analysis methods (“Master Method/Theorem”)
• Randomization in algorithm design
Will apply to: QuickSort, primality testing, graph partitioning,
hashing.
• Primitives for reasoning about graphs
Connectivity information, shortest paths, structure of
information and social networks.
• Use and implementation of data structures
Heaps, balanced binary search trees, hashing and some variants
(e.g., bloom filters)
Topics in Sequel Course
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
• Greedy algorithm design paradigm
• Dynamic programming algorithm design paradigm
• NP-complete problems and what to do about them
• Fast heuristics with provable guarantees
• Fast exact algorithms for special cases
• Exact algorithms that beat brute-force search
Skills Student will Learn
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
• Become a better programmer
• Sharpen your mathematical and analytical skills
• Start “thinking algorithmically”
• Literacy with computer science’s “greatest hits”
• Ace your technical interviews
Supporting Materials
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
• Kleinberg/Tardos, Algorithm Design, 2005.
• Dasgupta/Papadimitriou/Vazirani, Algorithms, 2006.
• Cormen/Leiserson/Rivest/Stein, Introduction to Algorithms,
2009 (3rd edition).
• Mehlhorn/Sanders, Data Structures and Algorithms: The Basic
Toolbox, 2008.
• “Mathematics for Computer Science”, by Eric Lehman and
Tom Leighton
Supporting Materials
MSc Course Weekly Outline
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Week Date Topics Covered
1 19/2/2017 General Introduction of design and analysis algorithm, explained the
topics of course.
2 26/2/2017 Introduction; "big-oh" notation and asymptotic analysis; divide-and-
conquer basics.
3 5/3/2017 The master method for analyzing (divide and conquer) algorithms; the
Quick Sort algorithm and its analysis; probability review
4 12/3/2017 Linear-time selection; graphs, cuts, and the contraction algorithm.
5 19/3/2017 Breadth-first and depth-first search; computing strong components;
applications.
6 26/3/2017 Dijkstra's shortest-path algorithms; heaps; balanced binary search
trees.
7 2/4/2017 Hashing; bloom filters.
8 9/4/2017 First Exam
9 16/4/2017 Two motivating applications; selected review; introduction to greedy
algorithms; a scheduling application; Prim's MST algorithm.
MSc Course Weekly Outline
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Week Date Topics Covered
10 23/4/2017 Kruskal's MST algorithm and applications to clustering; advanced
union-find (optional); Huffman codes.
11 30/4/2017 Dynamic programming: introduction, the knapsack problem, sequence
alignment, and optimal binary search trees
12 7/5/2017 The Bellman-Ford algorithm; all-pairs shortest paths.
13 14/5/2017 NP-complete problems and exact algorithms for them
14 21/5/2017 Approximation and local search algorithms for NP-complete problems;
the wider world of algorithms
15 28/5/2017 Second Exam
Algorithms
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Algorithm vs Program
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Program = Algorithm+ Data Structure
T(P)=Const. + TP
S(P)=Const. + SP
Time Complexity of
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Time Complexity of
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Space Complexity
Time Complexity of
Dr. Samaher Hussein Ali Notes of Lecture #122 February 2017
Note: The above relation accept if m <=n otherwise must used the relation :