COMP 1405 Study Guide - Infinite Loop, For Loop, Institute For Operations Research And The Management Sciences

105 views2 pages
14 Jul 2014
Course
Professor

Document Summary

Algorithms can be in a natural language, not necessarily programming languages. Have a set of input (possibly not) similar to ingredients. Body of algorithm is an unambiguous set of instructions. Output can be numerical, transformation of input (look up details from keywords), may represent physical changes e. g. baking a cake. There s a distinction between software and algorithms which is the termination state (toy software does not need to terminate) Syntax informs you of what instructions are available. Loops are statements used to execute commands over and over again. If the loop does not have an end condition, then it is an infinite loop and will continue running until there is no more memory accessible resulting in a crash. Loops that depend on the mouse pointer produce a subtle bug, possibly resulting in an infinite loop. Loops should always terminate, which can be done by setting up the loop to have a way to terminate such as a variable conditions.