230 likes | 273 Views
CS 615: Design & Analysis of Algorithms. Chapter 1: Introduction , Algorithmic Notation and Flowcharts. Course Content. Introduction , Algorithmic Notation and Flowcharts (Brassard & Bratley , Chap . 3) Efficiency of Algorithms (Brassard & Bratley , Chap 2)
E N D
CS 615: Design & Analysis of Algorithms Chapter 1: Introduction, Algorithmic Notation and Flowcharts
Course Content • Introduction, Algorithmic Notation and Flowcharts (Brassard & Bratley, Chap. 3) • Efficiency of Algorithms (Brassard & Bratley,Chap 2) • Basic Data Structures (Brassard & Bratley,Chap. 5) • Sorting (Weiss, Chap. 7) • Searching (Brassard & Bratley, Chap. 9) • Graph Algorithms (Weiss, Chap. 9) • Randomized Algorithms (Weiss, Chap. 10) • String Searching (Sedgewick, Chap. 19) • NP Completeness (Sedgewick, Chap. 40) CS 615 Design & Analysis of Algorithms
Content • Text books, • Lectures • Assessments • Asymptotic Notation • Notation for “the order of” • Maximum Rule • Flowcharts • Basic Flowchart Constructions CS 615 Design & Analysis of Algorithms
Instructor • Yusuf Altunel • Email: y.altunel@iku.edu.tr • Web: http://web.iku.edu.tr/~yaltunel • Tel: (212) 498 42 10 CS 615 Design & Analysis of Algorithms
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 • Algorithm Design: Foundations, Analysis, and Internet Examples; Michael T. Goodrich & Roberto Tamassia; Wiley, 2002, ISBN 978-0-471-38365-9. http://ww3.algorithmdesign.net/ • Algorithms, Robert Sedgewick, Addison-Wesley 1983, e-book. CS 615 Design & Analysis of Algorithms
Lectures • Courses and labs CS 615 Design & Analysis of Algorithms
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 CS 615 Design & Analysis of Algorithms
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. CS 615 Design & Analysis of Algorithms
Project • A real world application with dynamically constructed graph should be implemented until the end of the semester! • Details will be announced later! CS 615 Design & Analysis of Algorithms
Algorithmic Notation and Flowcharts (Brassard & BratleyChp: Chapter 3) CS 615 Design & Analysis of Algorithms
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 CS 615 Design & Analysis of Algorithms
Notation for “the order of” • f:NR0 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: NR0 such that • t(n) cf(n) for all nn0 • O(f(n))={t: NR0 |(cR+)(nN)[t(n) cf(n)]} • Examples • f(n)=n3-3n2-n-8 O(n3) • f(n)= n3 O(n3) • Maximum Rule: • Let f,g: NR0 be two arbitrary functions • O(f(n),g(n))=O(max(f(n),g(n))) CS 615 Design & Analysis of Algorithms
Example for Maximum Rule • An algorithm that proceeds in three steps: • Initialization • Take time in O(n2) • Processing • Take time in O(n3) • Finalization • Take time in O(nlogn) • The complete algorithm takes time in • O(n2 + n3 + nlogn) • = O(max(n2,n3,nlogn)) • =O(n3) CS 615 Design & Analysis of Algorithms
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)= 12n3- 5n2 + logn + 36 • O(f(n))=O(n3) • f(n)= 999999n94 - 345n35 + 1 • O(f(n))=O(n94) CS 615 Design & Analysis of Algorithms
Scale of Strength for O-Notation • the relationship between order of functions • O(1) < O(logn) < O(n) < O(nlogn) < O(n2) < O(n3) < O(2n) < O(10n) Higher in order More efficient CS 615 Design & Analysis of Algorithms
Examples • What is the order of 18nlog2n + 19n + 3 • =O(18nlog2n + 19n + 3) • =O(max (nlogn, n, 3) ) • =O(nlogn) • What is the order of n4 + 2n + 3nlogn + 3 • =O(n4 + 2n + 3nlogn + 3) • =O(max (n4, 2n, nlogn , 3) ) • =O(2n) CS 615 Design & Analysis of Algorithms
Flowcharts Process Data Decision Process Display Terminator CS 615 Design & Analysis of Algorithms
Basic Flowchart Constructions F T First Task Cond Else Part Then Part F Next Task Cond T Sequence If Then Else Repeat-Until CS 615 Design & Analysis of Algorithms
Basic Flowchart Constructions T Cond1 F Cond F T Cond2 T ... ... T Condn F While-Do Selection (Case) CS 615 Design & Analysis of Algorithms
Basic Flowchart Constructions initialization F Cond T for (i=1; i<n; i++) {..} for (<initialization>; <condition>; <post statement>) <statement> statement post statement For statement CS 615 Design & Analysis of Algorithms
Data Flow: Example Start Task1 if Cond1 then if Cond2 then Task2 else Task3 else repeat Task4 until Cond3 End Start Task1 T Cond1 F T F Cond2 Task4 Task2 Task3 Cond3 F T End CS 615 Design & Analysis of Algorithms
Example find Maximum Start max= infinitive Start max= minimum do get a number if (max<number) then max = number while more numbers show max End get a number T F max<number max=number T T More numbers? F Show max end CS 615 Design & Analysis of Algorithms
End of Chapter 1Introduction, Algorithmic Notation and Flowcharts CS 615 Design & Analysis of Algorithms