Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.

Slides:



Advertisements
Similar presentations
Algorithms.
Advertisements

Chapter 5 Algorithms. 2 Chapter 5: Algorithms 5.1 The Concept of an Algorithm 5.2 Algorithm Representation 5.3 Algorithm Discovery 5.4 Iterative Structures.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 2- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
© 2010 Pearson Education, Inc. All rights reserved.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 2: Algorithm Discovery and Design
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 2: Algorithm Discovery and Design
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object, Object- Relational, and XML: Concepts, Models, Languages,
Chapter 2 The Algorithmic Foundations of Computer Science
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
© 2010 Pearson Education, Inc. All rights reserved.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 7 Problem Solving with Loops
Chapter 1 Overview of Computers and Programming. Copyright ©2004 Pearson Addison-Wesley. All rights reserved.1-2 Figure 1.3 Components of a Computer.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Part 1 Conditionals and Loops.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Eleventh Edition by J.
Copyright © 2015 Pearson Education, Inc. Chapter 5: Algorithms.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Limits.
Chapter 5 Algorithms © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 5 Algorithms Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information Technology.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 4 Applications of the Derivative.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Functions.
Algorithm: definition An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process.
Chapter 5 Algorithms. © 2005 Pearson Addison-Wesley. All rights reserved 5-2 Chapter 5: Algorithms 5.1 The Concept of an Algorithm 5.2 Algorithm Representation.
Chapter 5: 演算法 Algorithms 陳以德助理教授 : 高醫大舊二棟 轉 2586
Searching Chapter 18 © 2015 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures and Abstractions with Java, 4e Frank.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
Chapter 5 Algorithms © 2007 Pearson Addison-Wesley. All rights reserved.
Computer Science: An Overview Eleventh Edition
Invitation to Computer Science 5 th Edition Chapter 2 The Algorithmic Foundations of Computer Science.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Q & A.
Computer Science: An Overview Eleventh Edition
Chapter 8 Arrays Objectives
Chapter 5: Algorithms Computer Science: An Overview Tenth Edition
Chapter 8 Arrays Objectives
Computer Science — An Overview J. Glenn Brookshear
Algorithmic Complexity
Chapter 8 Arrays Objectives
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Computer Science: An Overview Tenth Edition
Presentation transcript:

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn Brookshear

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-2 Chapter 5: Algorithms 5.1 The Concept of an Algorithm 5.2 Algorithm Representation 5.4 Iterative Structures 5.6 Algorithm Efficiency

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-3 Definition of Algorithm An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process.

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-4 Algorithm Representation Requires well-defined primitives A collection of primitives constitutes a programming language.

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-5 Figure 5.2 Folding a bird from a square piece of paper

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-6 Figure 5.3 Origami primitives

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-7 Pseudocode Primitives Assignment name  expression Conditional selection if condition then action

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-8 Pseudocode Primitives (continued) Repeated execution while condition do activity Procedure procedure name (generic names)

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-9 Figure 5.4 The procedure Greetings in pseudocode

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-10 Iterative Structures Pretest loop: while (condition) do (loop body) Posttest loop: repeat (loop body) until(condition)

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-11 Figure 5.6 The sequential search algorithm in pseudocode

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-12 Figure 5.7 Components of repetitive control

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-13 Figure 5.8 The while loop structure

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-14 Figure 5.9 The repeat loop structure

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-15 Figure 5.10 Sorting the list Fred, Alex, Diana, Byron, and Carol alphabetically

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-16 Figure 5.11 The insertion sort algorithm expressed in pseudocode

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-17 Algorithm Efficiency Measured as number of instructions executed Big theta notation: Used to represent efficiency classes –Example: Insertion sort is in Θ(n 2 ) Best, worst, and average case analysis

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-18 Figure 5.18 Applying the insertion sort in a worst-case situation

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-19 Figure 5.19 Graph of the worst-case analysis of the insertion sort algorithm

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-20 Figure 5.20 Graph of the worst-case analysis of the binary search algorithm