Introduction to Computational Thinking Algorithms: Discussion (C) Dennis Kafura 2016
Algorithms Basic building blocks of an algorithm Questions action : changing something sequence : doing one step after another decision : choosing whether to take an action iteration : repeating steps until a goal is reached state : the value of all of the properties Questions What can we learn by studying different solutions? What happens while an algorithm is running? (C) Dennis Kafura 2016
Three solutions (1) (2) (3) (C) Dennis Kafura 2016
What happens when an algorithm is running? Abstraction of the avatar Location (where it is in the maze) Heading (which way it is facing) North Abstraction Properties of the Avatar 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 West East Location Heading South Value of each property (C) Dennis Kafura 2016
During execution -1 Location Heading (C) Dennis Kafura 2016
During execution -2 Location Heading (C) Dennis Kafura 2016
During execution -3 Location Heading (C) Dennis Kafura 2016
During execution -4 Location Heading (C) Dennis Kafura 2016
State Idea State: the value of all properties at a give point in the execution of the algorithm The state changes as the algorithm is executed (performed) Only one state exists; previous states forgotten Note: some states not shown Location Heading 1 East Location Heading 2 East … Location Heading 6 South … Location Heading 8 North (C) Dennis Kafura 2016
Nature of state (dynamic) (static) (C) Dennis Kafura 2016