Download presentation
Presentation is loading. Please wait.
1
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
2
cell phones off (please) 2
3
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 3
4
Today’s Agenda Algorithms (chapter 5 in text) –Concept –Exercise 4
5
Algorithm Figure 5.1 of text An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process. 5
6
ordered Steps have an order Parallelism is allowed 6
7
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. 7
8
unambiguous Steps must be clear –Cannot have more than one interpretation 8
9
terminating The overall process must stop at some point. Non-terminating processes are useful (e.g. web server) Termination is important in defining computability. 9
10
Describing algorithms Primitives – set of base elements, such as: –Sequencing –Selection –Repetition –Naming 10
11
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 11
12
What’s available? –New peanut butter jar –New jelly jar –Bag of sliced loaf bread –Knife –Spoon –Lots of paper towels 12
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.