Download presentation

Presentation is loading. Please wait.

1
**The Efficiency of Algorithms**

Chapter 3 The Efficiency of Algorithms

2
**Figure 3.3 A Choice of Algorithms**

3
**Figure 3.3.1 The Shuffle-Left Algorithm – Original Configuration**

4
**Figure 3.3.1 The Shuffle-Left Algorithm – The Value of Legit- First Copy**

5
**Figure 3.3.1 The Shuffle-Left Algorithm – The Value of Legit – Second Copy**

6
**Figure 3.3.1 The Shuffle-Left Algorithm – The Value of Legit – The Third Copy**

7
Figure The Shuffle-Left Algorithm- The Value of Legit – After Last Item is Copied, the Result is This

8
Figure The Shuffle-Left Algorithm – The Value of Legit – Reset the Right Hand Finger to Start Again

9
Figure – The Shuffle-Left Algorithm – The Value of Legit – Left and Right Hand Finger Move Forward

10
**Figure 3.3.1 – The Shuffle Left Algorithm – The Value of Legit – Moving along, we pass over the 16.**

11
**Figure 3.3.1 The Shuffle-Left Algorithm – The Value of Legit-Seven Copies squeeze out O**

12
Figure The Shuffle-Left Algorithm – The Value of Legit - The 36, 42, 23, and 21 Are Passed Over; This is the Result

13
Figure The Shuffle-Left Algorithm – The Value of Legit – Squeezing out Final 0 Gives This Result

14
Figure – The Shuffle Left Algorithm – The Value of Legit – The Left Hand Finger is Pointing At a Nonzero Element, so Another Advance of Both Fingers Gives Us This Configuration.

15
**Figure 3.3.2 The Copy-Over Algorithm**

16
**Figure 3.3.3 The Converging-Pointers Algorithm – The Value of Legit**

17
Figure The Converging-Pointers Algorithm – The Value of Legit – Legit and Right Are Reduced by 1.

18
**Figure 3.3.3 The Converging-Pointers Algorithm – The Value of Legit – The Value of Left Increases**

19
Figure The Converging-Pointers Algorithm – The Value of Legit – Position Right is Copied Into Position Left

20
Figure The Converging-Pointers Algorithm – The Value of Legit –Item at Position Left is Still 0, Another Copy Takes Place

21
**Practice Problems - In the Data Cleanup Problem, Suppose the Original Data Is Like This**

22
**Figure 3.6 Values of Magnitude – Work = 2n**

23
**Figure 3.7 Order of Magnitude - Work = cn for Various Values of c**

24
**Figure 3.8 – Order of Magnitude – Growth of Work = cn for Various Values of c**

25
**Figure 3.9 Order of Magnitude -Table of Calling Information**

26
**Figure 3.10 –Order of Magnitude – Work = cn2 for Various Values c**

27
**Figure 3.11 The 0rder of Magnitude – A Comparison of n and n2**

28
**Figure 3. 12 – Order of Magnitude – For Large Enough n, 0**

Figure 3.12 – Order of Magnitude – For Large Enough n, 0.25n2 Has Larger Values than 10n

29
**Figure 3.13 Order of Magnitude – A Comparison of Two Extreme Θ (n2) and Θ (n) Algorithms**

30
**Using the Information in Figure 3**

Using the Information in Figure 3.5 Fill in the Above Table for the Number of Comparisons required in the Sequential Search Algorithm

31
**Figure 3.14 Analysis of Algorithms – Analysis of Three Data Cleanup Algorithms**

32
**Figure 3.16 Selection Sort Algorithms – Comparisons Required by Selection Sort**

33
**Figure 3.17 –Selection Sort Algorithms - An Attempt to Exchange the Values at X and Y**

34
**Figure 3.18 Selection Sort Algorithms – Exchanging the Values of X and Y**

35
**Figure 3.21 Binary Search – Values of n and lg n**

36
**Figure 3.22 Binary Search – A comparison of n and lg n**

37
**Figure 3.23 Summary – Order-of-Magnitude Time Efficiency Summary**

38
**Figure 3.24 When Things Get Out of Hand – Four Connected Cities**

39
Figure When Things Get Out of Hand – Hamiltonian Circuits Among All Paths from A in Figure 3.24 with Four Links

40
**Figure 3.26 (a) When Things Get Out of Hand – Comparisons of lg n, n, n2, and 2n**

41
**Figure 3.26 (b) When Things Get Out of Hand – Comparisons of lg n,n, n2, and 2n**

42
**Figure 3.28 Approximation Problems – A First-Fit Solution to a Bin-Packing Problem**

43
**Practice Problems – Tree Shows All Paths with Two Links That Begin At Node A**

44
Exercises – Write the Data List that Results from running the Shuffle-Left Algorithm to clean up this Data

45
**Exercises – A Linked List**

46
**Exercises Draw a Linked List when Data Cleanup is Performed on This Linked List**

Similar presentations

OK

CPSC 171 Introduction to Computer Science Efficiency of Algorithms.

CPSC 171 Introduction to Computer Science Efficiency of Algorithms.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on power sharing in belgium and sri lanka Ppt on soft skills for engineering students Ppt on bullet train in india Seminar ppt on google glass Ppt on active directory 2008 Opening ppt on mac Download ppt on sexual reproduction in flowering plants Ppt on obesity prevention and awareness Ppt on verb tenses Ppt on physical properties of metals and nonmetals