design and analysis of algorithms - kentaleitert/daa/slides/00introduction.pdfalgorithms...

Post on 19-May-2021

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Design and Analysis of Algorithms

This Class

Website and ContactWebsite

I www.cs.kent.edu/~aleitert/daa/I Important informationI SlidesI AnnouncementsEmail

I aleitert@cs.kent.edu

3 / 19

Primary Textbook

A L G O R I T H M SI N T R O D U C T I O N T O

T H I R D E D I T I O N

T H O M A S H.

C H A R L E S E.

R O N A L D L .

C L I F F O R D S T E I N

R I V E S T

L E I S E R S O N

C O R M E NIntroduction to Algorithms,by Cormen et al.3rd edition, MIT Press, 2009Primary source for this class.

4 / 19

Other TextbooksThe Algorithm Design Manual,by Steven S. Skiena2nd edition, Springer, 2008PDF-Version available for free atSpringer Link

5 / 19

Other Textbooks

ptg

Algorithms, 4th Edition,by Robert Sedgewick and Kevin Wayne4th edition, Addison-Wesley Professional, 2011

Algorithm Design: Foundations, Analysis, and InternetExamples,by Michael T. Goodrich and Roberto Tamassia, 1stedition, Wiley, 2001

6 / 19

Clarification

ClarificationYou do not need (to buy) a textbook. These are recommendations if youare looking for a textbook to study.

7 / 19

Course RequirementsExam 1 33.3% June 30, during classExam 2 33.3% July 19, during classExam 3 33.3% Aug 4, during class(Dates may change.)Exams

I closed book examinationI one handwritten sheet (one side) allowedHomework

I Will not be graded.I Good preparation for exams.

8 / 19

Office HoursOn appointmentRoom 352, Math and CS BuildingSend me an email if you want to meet.

9 / 19

Academic Presence VerificationDue to federal rules, instructors “must verify that students beginattendance in each course for which they are registered.”Required to receive federal financial aid.Verification of Your Attendance

I Sign attendance sheet once.

10 / 19

Algorithms

AlgorithmQuestionWhat is an algorithm?

WikipediaAn algorithm is a self-contained step-by-step set of operations to beperformed. [...] An algorithm is an effective method that can beexpressed within a finite amount of space and time [...] forcalculating a function. Starting from an initial state and initial input,the instructions describe a computation that [...] proceeds through afinite number of well-defined successive states, eventually producing“output” and terminating at a final ending state.

12 / 19

AlgorithmQuestionWhat is an algorithm?

WikipediaAn algorithm is a self-contained step-by-step set of operations to beperformed. [...] An algorithm is an effective method that can beexpressed within a finite amount of space and time [...] forcalculating a function. Starting from an initial state and initial input,the instructions describe a computation that [...] proceeds through afinite number of well-defined successive states, eventually producing“output” and terminating at a final ending state.

12 / 19

Algorithm

AlgorithmInput Output

13 / 19

Properties of AlgorithmsCorrectness

I Will it produce the desired output?I We will prove that our algorithms are correct.Efficiency

I How fast is the algorithm?I How much resources does it need?I Is there a faster algorithm?Having one of both properties is (usually) easy. However, having both is thegoal.

14 / 19

Example

Problem

Finding doublesYou are given two integer arrays A and B. Is there an integer i which is inboth arrays?

16 / 19

Algorithm 1

1 For Each a ∈ A

2 For Each b ∈ B

3 If a = b Then4 Return “Yes”5 Return “No”

17 / 19

Algorithm 21 Sort A and B.2 Set i := 0 and j := 0.3 While i < |A| and j < |B |

4 If A[i ] = B[j ] Then5 Return “Yes”6 Else If A[i ] < B[j ] Then7 Set i := i + 1.8 Else If A[i ] > B[j ] Then9 Set j := j + 1.10 Return “No”

18 / 19

Question

QuestionWhich algorithm is better and why?

19 / 19

top related