214-thinking-logically-elements-of-computational-thinking Flashcards
thinking logically steps
- identifying points in a solution where a decision has to be taken e.g branching, looping
- determine logical conditions (e.g x>y) that affect the outcome of a decision
- how those decisions will change the flow of the program by tracing it and test cases
Good algorithm
- clear and precisely stated steps that produce the correct output for any set of valid inputs
- invalid inputs rejected
- must always terminate at some point
-should execute efficiently in as few steps as possible - design makes it so other people would be able to understand it and modify it
Tools for designing algorithms and thinking logically
Hierarchy charts - useful for identifying the major tasks, and breaking these down into sub tasks
Flowcharts- designing algorithm, getting down initial ideas for individual subroutines
Pseudocode- translate easily into program code
Decisions
represented by boolean expressions
evaluated in a selection/iteration statement causing code to branch/loop
determine how different parts of the program will be completed/route
important to identify all the decisions that need to be made, to be informed and gather enough info about the options
Trace table
used to write down the contents of each variable as it changes during execution
-useful for figuring how the algorithm works or finding out why it is not working properly