This preview shows page 1. Sign up to view the full content.
Unformatted text preview: eeks or months ago must really be annoyed." "This smacks a little of desperation, and it's very unlike Apple." News Flash!
Doh! News Flash!
iPhone launched After iPhone announced oops? Hype/Excitement Builds The good news: Apple stock still doubled in one year... Sequence Selection Iteration All Algorithms Utilize 3 Primary Tools Sequence Selection Iteration All Algorithms Utilize 3 Primary Tools
Greatest Common Factor 1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end Sequence Selection Iteration All Algorithms Utilize 3 Primary Tools
Greatest Common Factor 1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end Commands follow in a specific linear order. Often this order is implicit. Algorithms invoke other algorithms. Sequence Selection Iteration All Algorithms Utilize 3 Primary Tools
Greatest Common Factor 1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end Selective execution of instructions based on a particular condition. Sequence Selection Iteration All Algorithms Utilize 3 Primary Tools
Greatest Common Factor 1: Request a value for a 2: Request a value for b 3: if a b then assign b to c 4: if a < b then assign a to c 5: while (remainder(a, c)0 OR remainder(b, c)0) 6: subtract one from c 7: return c 8: end Repetitive execution of a group of instructions as long as some condition is met. What Tool(s) Does this Algorithm Use?
1. 2. 3. 4. 5. Request a value for A Request a value for B If AB Return B If A<B Return A End This algorithm utilizes: a) Only Sequence b) Sequence and Selection c) Sequence and Iteration d) Sequence, Selection and Iteration What Tool(s) Does this Algorithm Use?
1. 2. 3. 4. 5. Request a value for A Request a value for B If AB Return B If A<...
View
Full
Document
 Fall '07
 Ringenberg
 Algorithms

Click to edit the document details