Lecture 11: Algorithms and Time Complexity I Discrete Mathematical Structures: Theory and Applications.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

LEUCEMIA MIELOIDE AGUDA TIPO 0
Práctica con el verbo tener 1.I have a notebook. 2.She has a pen. 3.They have a car. 4.We have some notebooks. 5.You have a pencil.
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advanced Piloting Cruise Plot.
Supplemental Web Fig. 2 mos10/mos10, grown on 100 mm plate SLAS27 medium, day 1.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 38.
1 Chapter 40 - Physiology and Pathophysiology of Diuretic Action Copyright © 2013 Elsevier Inc. All rights reserved.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Source of slides: Introduction to Automata Theory, Languages and Computation.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
ZMQS ZMQS
Micro Focus Research 1 As far as youre aware, how does your organization plan to drive business growth over the next three years? (Respondents' first choices)
Data Structures Using C++ 2E
Richmond House, Liverpool (1) 26 th January 2004.
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
ABC Technology Project
© S Haughton more than 3?
© Charles van Marrewijk, An Introduction to Geographical Economics Brakman, Garretsen, and Van Marrewijk.
© Charles van Marrewijk, An Introduction to Geographical Economics Brakman, Garretsen, and Van Marrewijk.
© Charles van Marrewijk, An Introduction to Geographical Economics Brakman, Garretsen, and Van Marrewijk.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Twenty Questions Subject: Twenty Questions
Linking Verb? Action Verb or. Question 1 Define the term: action verb.
Squares and Square Root WALK. Solve each problem REVIEW:
Energy & Green Urbanism Markku Lappalainen Aalto University.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Chapter 5 Test Review Sections 5-1 through 5-4.
SIMOCODE-DP Software.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
Week 1.
Analyzing Genes and Genomes
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Figure Essential Cell Biology (© Garland Science 2010)
A SMALL TRUTH TO MAKE LIFE 100%
1 Unit 1 Kinematics Chapter 1 Day
PSSA Preparation.
How Cells Obtain Energy from Food
Data Structures Using C++ 2E The Big-O Notation. Data Structures Using C++ 2E2 Algorithm Analysis: The Big-O Notation Analyze algorithm after design Example.
12-Apr-15 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
CS 3610/5610N data structures Lecture: complexity analysis Data Structures Using C++ 2E1.
Department of Computer Science 1 COSC 2320 Section Room 104 AH 5:30 – 7:00 PM TTh Professor Olin Johnson Office 596 PGH
Data Structures Using C++ 2E Chapter 1 Software Engineering Principles and C++ Classes.
Data Structures Using C++ 2E
Data Structures Using C++ 2E
Data Structures Using The Big-O Notation 1.
Presentation transcript:

Lecture 11: Algorithms and Time Complexity I Discrete Mathematical Structures: Theory and Applications

Discrete Mathematical Structures: Theory and Applications 2 Learning Objectives Learn about algorithm analysis Become familiar with big-O, omega, and theta notations Explore various algorithms and their time complexity

Discrete Mathematical Structures: Theory and Applications 3 Algorithm Analysis A gift company that delivers calculates the shortest distance from the shop to a particular destination and hands the route to the driver. 50 packages are to be delivered to 50 different houses. The 50 houses are located 1 mile apart and are in the same area. The first house is also 1 mile from the shop.

Discrete Mathematical Structures: Theory and Applications 4 Algorithm Analysis Each dot represents a house and the distance between houses is 1 mile, as shown in Figure 9.2.

Discrete Mathematical Structures: Theory and Applications 5 Algorithm Analysis To deliver 50 packages to their destinations, one of the drivers picks up all 50 packages, drives 1 mile to the first house, and delivers the first package. Then the driver drives another mile and delivers the second package, drives another mile and delivers the third package, and so on.

Discrete Mathematical Structures: Theory and Applications 6 Algorithm Analysis Using this scheme, the distance driven to deliver the packages is: · · ·+ 1 = 50 miles Therefore, the total distance traveled to deliver the packages and then return to the shop is: = 100 miles

Discrete Mathematical Structures: Theory and Applications 7 Algorithm Analysis Another driver is given a similar route to deliver another set of 50 packages. The driver looks at the route and delivers the packages as follows: The driver picks up the first package, drives 1 mile to the first house, delivers the package, and then returns to the shop. Next, the driver picks up the second package, drives 2 miles, delivers the package, and returns to the shop. The driver then picks up the third package, drives 3 miles, delivers the package, and returns to the shop.

Discrete Mathematical Structures: Theory and Applications 8 Algorithm Analysis This driver delivers only one package at a time. After delivering a package, the driver comes back to the shop to pick up and deliver the second package. Using this scheme, the total distance traveled is: 2 · ( · · ·+ 50) = 2550 miles Now suppose that there are n packages to be delivered to n houses, and each house is 1 mile apart as shown in Figure 9.2. If the packages are delivered using the first scheme, the following equation gives the total distance traveled: · · ·+1 + n = 2n (9.1)

Discrete Mathematical Structures: Theory and Applications 9 Algorithm Analysis

Discrete Mathematical Structures: Theory and Applications 10 Algorithm Analysis When analyzing a particular algorithm, count the number of operations that the algorithm executes. Focus on the number of operations, not on the actual computer time to execute the algorithm. This is because a given algorithm can be implemented on a variety of computers and the speed of the computer can affect the execution time. However, the number of operations performed by the algorithm would be the same on each computer.

Discrete Mathematical Structures: Theory and Applications 11

Discrete Mathematical Structures: Theory and Applications 12

Discrete Mathematical Structures: Theory and Applications 13

Discrete Mathematical Structures: Theory and Applications 14

Discrete Mathematical Structures: Theory and Applications 15 Algorithm Analysis

Discrete Mathematical Structures: Theory and Applications 16

Discrete Mathematical Structures: Theory and Applications 17

Discrete Mathematical Structures: Theory and Applications 18

Discrete Mathematical Structures: Theory and Applications 19 Algorithm Analysis

Discrete Mathematical Structures: Theory and Applications 20

Discrete Mathematical Structures: Theory and Applications 21

Discrete Mathematical Structures: Theory and Applications 22