CS 4/56101 Design and Analysis of Alg lgorithms Fall ll 2020
Website and Contact • Course Website: • http://www.cs.kent.edu/~aalbaghd/DAAFall20 • Important information • Slides • Announcements • Instructor: • Ahmed Al-Baghdadi • Email: aalbaghd@kent.edu • Office hours: 5:00p.m. to 6:00p.m. Tuesday and Thursday
Learning objectives • Advanced data structures and their analysis • To think algorithmically like a "real" computer scientist • Different techniques and methods for designing efficient algorithms for solving computational problems • Students will develop • the ability to design efficient algorithms • the ability to prove correctness and evaluate efficiency of algorithms
Course Goals • Study important data structures and algorithmic techniques not normally covered in CS 23001 • Develop ability to design efficient algorithms • Develop ability to prove correctness and evaluate efficiency of algorithms • **The main goal of the course is to learn to think algorithmically like a ``real'' computer scientist
Topics will include: • Computational Model and Runtime Analysis • Binary Search • Insertion, Merge, and Quicksort • Heaps and Priority Queues • Linear Time Sorting • Red-Black, AVL, and B-Trees • Hash Tables • Graphs • Basic Algorithms • DAGs • Minimum Spanning Tree • Shortest Path (Dijkstra)
Textbook • Introduction to Algorithms, by Cormen et al. 3rd edition, MIT Press, 2009 Primary source for this class.
Other Books • Algorithm Design: Foundations, Analysis, and Internet Examples, by Michael T. Goodrich and Roberto Tamassia, 1st edition, Wiley, 2001 • The Algorithm Design Manual, by Steven S. Skiena 2nd edition, Springer, 2008
Note • You do not need (to buy) a textbook. These are recommendations if you are looking for a textbook to study.
Course Requirements • Homework 35% • Download from the course website • Deadline will be announced on the course website • Midterm Exam 30% • (Week 7 (Oct. 6), in class time via Blackboard) • Final Exam 30% • (Will be decided between Dec. 14 Dec. 20) • Attendance 5% • ** NOTE: Exam dates and deadlines are tentative. Exact dates will be announced in class!!!
Class Policies • Late Policy • Homework must be sent submitted by Blackboard by the due date shown on the course website • Unexcused late homework is not accepted • Missed exams and missed homework are only excused if absence was essential and can be fully documented. • Registration Requirements • Sept. 2nd: Official registration deadline • Sept. 9th: Last day to drop before grade of "W" is assigned is • Nov. 11th: Last day to withdraw
Homework and Collaboration • You will need to devote a considerable amount of time to homework • You may discuss the homework with other students, but you must write your solutions independently • If you obtain a solution to a homework problem through research (e.g., from books or journals), you are expected to acknowledge your sources in your write up and also to write up your solution independently
Milestone for successful completion of the course • Attend the classes regularly • Perform the homework thoroughly and independently • Read a head • Read the book carefully and several times • Ask Questions
What is an algorithm? • Algorithm • a set of steps to accomplish a task
What is an algorithm? • Algorithm • a set of steps to accomplish a task • Example: • Making Pizza
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Search algorithm
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Search algorithm (Find the Maximum) High-level description: 1.If there are no numbers in the set then there is no highest number. 2.Assume the first number in the set is the largest number in the set. 3.For each remaining number in the set: if this number is larger than the current largest number, consider this number to be the largest number in the set. 4.When there are no numbers left in the set to iterate over, consider the current largest number to be the largest number of the set.
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Search algorithm High-level description: 1.If there are no numbers in the set then there is no highest Algorithm LargestNumber number. Input: A list of numbers L . Output: The largest number in the list L . 2.Assume the first number in the set is the largest number in the if L.size = 0 set. return null 3.For each remaining number in the set: if this number is larger largest ← L [0] than the current largest number, consider this number to be the for each item in L , do largest number in the set. if item > largest , 4.When there are no numbers left in the set to iterate over, then largest ← item consider the current largest number to be the largest number of return largest the set.
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Path Finding (Google Maps)
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Path Finding (Google Maps)
What is an algorithm? • Algorithm in Computer Science • an algorithm is a set of steps for a computer program to accomplish a task • Examples of CS Algorithms • Path Finding (Google Maps)
What makes a good algorithm? • The two most important criteria • will it solve the problem? • produce the desired output? • prove that our algorithms are correct • will it solve the problem efficiently? • how fast is the algorithm? • how much resources does it need? • is there a faster algorithm? • Having one of both properties is (usually) easy. However, having both is the goal.
Problem Example • You are given two integer arrays A and B. Is there an integer i which is in both arrays?
Problem Example • You are given two integer arrays A and B. Is there an integer i which is in both arrays? • First Algorithm 1- For Each a ∈ A For Each b ∈ B 2- 3- If a = b Then Return “Yes” 4- 5- Return “No”
Problem Example • You are given two integer arrays A and B. Is there an integer i which is in both arrays? • Second Algorithm 1 Sort A and B. 2 Set i := 0 and j := 0. 3 While i < |A| and j < |B| 4 If A[i] = B[j] Then Return “Yes” 5 6 Else If A[i] < B[j] Then 7 Set i := i + 1. 8 Else If A[i] > B[j] Then 9 Set j := j + 1. 10 Return “No”
Problem Example • Which algorithm is better and why? 1- For Each a ∈ A 1 Sort A and B. 2- For Each b ∈ B 2 Set i := 0 and j := 0. 3- If a = b 3 While i < |A| and j < |B| Then Return “Yes” 4- 4 If A[i] = B[j] Then 5- Return “No” Return “Yes” 5 6 Else If A[i] < B[j] Then 7 Set i := i + 1. 8 Else If A[i] > B[j] Then 9 Set j := j + 1. 10 Return “No”
Recommend
More recommend