Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 615: Design & Analysis of Algorithms Chapter 1: Introduction, Algorithmic Notation and Flowcharts.

Similar presentations


Presentation on theme: "CS 615: Design & Analysis of Algorithms Chapter 1: Introduction, Algorithmic Notation and Flowcharts."— Presentation transcript:

1 CS 615: Design & Analysis of Algorithms Chapter 1: Introduction, Algorithmic Notation and Flowcharts

2 29 October 2015CS 615 Design & Analysis of Algorithms2 Course Content 1.Introduction, 1.Introduction, Algorithmic Notation and Flowcharts (Brassard & Bratley, Chap. 3) 2.Efficiency of Algorithms (Brassard & Bratley, Chap 2) 3.Basic Data Structures (Brassard & Bratley, Chap. 5) 4.Sorting (Weiss, Chap. 7) 5.Searching (Brassard & Bratley, Chap. 9) 6.Graph Algorithms (Weiss, Chap. 9) 7.Randomized Algorithms (Weiss, Chap. 10) 8.String Searching (Sedgewick, Chap. 19) 9.NP Completeness (Sedgewick, Chap. 40)

3 29 October 2015CS 615 Design & Analysis of Algorithms3 Content Text books, Lectures Assessments Asymptotic Notation Notation for “the order of” Maximum Rule Flowcharts Basic Flowchart Constructions

4 29 October 2015CS 615 Design & Analysis of Algorithms4 Instructor Yusuf Altunel Email: y.altunel@iku.edu.tr Web: http://web.iku.edu.tr/~yaltunel Tel: (212) 498 42 10

5 29 October 2015CS 615 Design & Analysis of Algorithms5 Text Books Main Resources Data Structures and Algorithm Analysis in C, 2nd Edition; Mark Allen Weiss; Addison Wesley Longman, 1997 Fundamentals of Algorithmics; Gilles Brassard & Paul Bratley; Prentice- Hall, 1996. Data Structures, Algorithms & Software Principles, Thomas A. Standish, Addison Wesley, 1995. Other Resources Algorithms, Richard Johnsonbaugh and Marcus Schaefer, Pearson, 2004, ISBN 0-02-360692-4. http://condor.depaul.edu/~rjohnson/algorithm/index.html http://condor.depaul.edu/~rjohnson/algorithm/index.html Algorithm Design: Foundations, Analysis, and Internet Examples; Michael T. Goodrich & Roberto Tamassia; Wiley, 2002, ISBN 978-0-471-38365-9. http://ww3.algorithmdesign.net/ http://ww3.algorithmdesign.net/ Algorithms, Robert Sedgewick, Addison-Wesley 1983, e-book.

6 29 October 2015CS 615 Design & Analysis of Algorithms6 Lectures Courses and labs DayHoursLocation TheoryThu11:00-12:45 (2 Hours)Lab 251 LabFri11:00-12:45 (2 Hours)Lab 251

7 29 October 2015CS 615 Design & Analysis of Algorithms7 Follow up the course Use the web page of the course http://web.iku.edu.tr/~yaltunel/Spring2005/CS615 Use the email group of the course Send an empty email to subscribe: CS_615-subscribe@yahoogroups.com To send a message: CS_615@yahoogroups.com To access on web: http://groups.yahoo.com/group/CS_615

8 29 October 2015CS 615 Design & Analysis of Algorithms8 Assessment Participation %10 Project %30 MidTerm %30 Final %40 Bonus Grading: %110 %10 Bonus Please take care of the rules and regulations of the University. Otherwise you might be reported to the faculty, as well as lose all bonus options of this course.

9 29 October 2015CS 615 Design & Analysis of Algorithms9 Project A real world application with dynamically constructed graph should be implemented until the end of the semester! Details will be announced later!

10 29 October 2015CS 615 Design & Analysis of Algorithms10 Algorithmic Notation and Flowcharts (Brassard & Bratley Chp: Chapter 3)

11 29 October 2015CS 615 Design & Analysis of Algorithms11 Asymptotatic Notation Used to express The time taken by an algorithm Within a multiplicative constant Permits Simplification in measuring other tangible things Deals with The behavior of functions in the limits For sufficiently large parameters An asymptotically superior algorithm is very often preferable

12 29 October 2015CS 615 Design & Analysis of Algorithms12 Notation for “the order of” f:N  R  0 be an arbitrary function from the natural numbers to the nonnegative numbers The mathematical symbol order of is denoted by O(f(n)) the set of all functions t: N  R  0 such that t(n)  cf(n) for all n  n 0 O(f(n))={t: N  R  0 |(  c  R + )(  n  N)[t(n)  cf(n)]} Examples f(n)=n 3 -3n 2 -n-8  O(n 3 ) f(n)= n 3  O(n 3 ) Maximum Rule: Let f,g: N  R  0 be two arbitrary functions O(f(n),g(n))=O(max(f(n),g(n)))

13 29 October 2015CS 615 Design & Analysis of Algorithms13 Example for Maximum Rule An algorithm that proceeds in three steps: Initialization Take time in O(n 2 ) Processing Take time in O(n 3 ) Finalization Take time in O(nlogn) The complete algorithm takes time in O(n 2 + n 3 + nlogn) = O(max(n 2,n 3,nlogn)) =O(n 3 )

14 29 October 2015CS 615 Design & Analysis of Algorithms14 Results of Maximum Rule If t(n) is a complicated function the most significant term of t(n) gives the order of function discarding its coefficient Example: f(n)= 12n 3 - 5n 2 + logn + 36 O(f(n))=O(n 3 ) f(n)= 999999n 94 - 345n 35 + 1 O(f(n))=O(n 94 )

15 29 October 2015CS 615 Design & Analysis of Algorithms15 Scale of Strength for O-Notation the relationship between order of functions O(1) < O(logn) < O(n) < O(nlogn) < O(n 2 ) < O(n 3 ) < O(2 n ) < O(10 n ) O(1) O(logn) O(n) O(nlogn) O(n 2 ) O(n 3 ) O(2 n ) O(10 n ) Higher in order More efficient

16 29 October 2015CS 615 Design & Analysis of Algorithms16 Examples What is the order of 18nlog 2 n + 19n + 3 =O(18nlog 2 n + 19n + 3) =O(max (nlogn, n, 3) ) =O(nlogn) What is the order of n 4 + 2 n + 3nlogn + 3 =O(n 4 + 2 n + 3nlogn + 3) =O(max (n 4, 2 n, nlogn, 3) ) =O(2 n )

17 29 October 2015CS 615 Design & Analysis of Algorithms17 Flowcharts Process Decision Data Terminator Display

18 29 October 2015CS 615 Design & Analysis of Algorithms18 Basic Flowchart Constructions First Task Next Task Sequence Cond Else Part Then Part FT Cond F T If Then ElseRepeat-Until

19 29 October 2015CS 615 Design & Analysis of Algorithms19 Basic Flowchart Constructions Cond 1 F T Cond F T Selection (Case) While-Do Cond 2... T Cond n F T...

20 29 October 2015CS 615 Design & Analysis of Algorithms20 Basic Flowchart Constructions for (i=1; i<n; i++) {..} for ( ; ; ) initialization Cond statement post statement T F For statement

21 29 October 2015CS 615 Design & Analysis of Algorithms21 Data Flow: Example End Cond 1 Task 2 FT Start Task 1 Cond 2 Task 3 Task 4 Cond 3 FT T F Start Task 1 if Cond 1 then if Cond 2 then Task 2 else Task 3 else repeat Task 4 until Cond 3 End

22 29 October 2015CS 615 Design & Analysis of Algorithms22 Example find Maximum max<number F T Start get a number max= infinitive max=number More numbers? T end Show max T F Start max= minimum do get a number if (max<number) then max = number while more numbers show max End

23 29 October 2015CS 615 Design & Analysis of Algorithms23 End of Chapter 1 Introduction, Algorithmic Notation and Flowcharts


Download ppt "CS 615: Design & Analysis of Algorithms Chapter 1: Introduction, Algorithmic Notation and Flowcharts."

Similar presentations


Ads by Google