120 likes | 200 Views
CSE111: Great Ideas in Computer Science. Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu. cell phones off (please). Announcements. Exam 1 & 2 handback HW4 due April 2 Part 1 this week in recitation Part 2 next week in recitation
E N D
CSE111: Great Ideas in Computer Science Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu
cell phones off (please)
Announcements • Exam 1 & 2 handback • HW4 due April 2 • Part 1 this week in recitation • Part 2 next week in recitation • Third is exam is April 21 (last full week of classes) • We will be taking attendance • Does not count directly for grade • Just curious who is and is not attending
Today’s Agenda • Algorithms (chapter 5 in text) • Concept • Exercise
Algorithm • Figure 5.1 of text An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process.
ordered • Steps have an order • Parallelism is allowed
executable • Must be able to carry out each step • Cannot have a step like “list all numbers” because there are infinitely many numbers • Cannot invoke magic (turn lead into gold) • etc.
unambiguous • Steps must be clear • Cannot have more than one interpretation
terminating • The overall process must stop at some point. • Non-terminating processes are useful (e.g. web server) • Termination is important in defining computability.
Describing algorithms • Primitives – set of base elements, such as: • Sequencing • Selection • Repetition • Naming
Exercise • Develop an algorithm for making a peanut butter and jelly sandwich. • Work in groups of about 3 • Write down ideas on paper • Put names on paper • Hand in at end of class
What’s available? • New peanut butter jar • New jelly jar • Bag of sliced loaf bread • Knife • Spoon • Lots of paper towels