CS 4/56101 Design and Analysis of Alg lgorithms Fall ll 2020 - - PowerPoint PPT Presentation

cs 4 56101
SMART_READER_LITE
LIVE PREVIEW

CS 4/56101 Design and Analysis of Alg lgorithms Fall ll 2020 - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

CS 4/56101 Design and Analysis of Alg lgorithms Fall ll 2020

slide-2
SLIDE 2

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
slide-3
SLIDE 3

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
slide-4
SLIDE 4

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

slide-5
SLIDE 5

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)
slide-6
SLIDE 6

Textbook

  • Introduction to Algorithms, by Cormen et al.

3rd edition, MIT Press, 2009 Primary source for this class.

slide-7
SLIDE 7

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

slide-8
SLIDE 8

Note

  • You do not need (to buy) a textbook. These are recommendations if

you are looking for a textbook to study.

slide-9
SLIDE 9

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!!!

slide-10
SLIDE 10

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
slide-11
SLIDE 11

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

slide-12
SLIDE 12

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
slide-13
SLIDE 13

What is an algorithm?

  • Algorithm
  • a set of steps to accomplish a task
slide-14
SLIDE 14

What is an algorithm?

  • Algorithm
  • a set of steps to accomplish a task
  • Example:
  • Making Pizza
slide-15
SLIDE 15

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
slide-16
SLIDE 16

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.

slide-17
SLIDE 17

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

Algorithm LargestNumber Input: A list of numbers L. Output: The largest number in the list L. if L.size = 0 return null largest ← L[0] for each item in L, do if item > largest, then largest ← item return largest

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.

slide-18
SLIDE 18

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)
slide-19
SLIDE 19

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)
slide-20
SLIDE 20

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)
slide-21
SLIDE 21

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.

slide-22
SLIDE 22

Problem Example

  • You are given two integer arrays A and B. Is there an integer i which is

in both arrays?

slide-23
SLIDE 23

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 2- For Each b ∈ B 3- If a = b 4- Then Return “Yes” 5- Return “No”

slide-24
SLIDE 24

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 5 Return “Yes” 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”

slide-25
SLIDE 25

Problem Example

  • Which algorithm is better and why?

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 5 Return “Yes” 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” 1- For Each a ∈ A 2- For Each b ∈ B 3- If a = b 4- Then Return “Yes” 5- Return “No”