CS 1371 Lecture Notes - Lecture 4: Hard Coding, Matlab, Infinite Loop

56 views4 pages

Document Summary

Iteration in terms of computer science is the repetition of a block of code. For example, you would use iteration if you wanted to multiply all the elements in a vector together. Whereas you as a human might approach the problem all at once and do it all in one step, a computer would need to break it down. Iteration is useful so you don"t have to hard code everything or use any sort of brute force approach. You can just write an elegant loop to handle an issue once and then run the loop until all of the issues of the same type are solved. (we call the implementation of iteration a loop. ) Consider a sudoku problem wherein you have to check to see if a solution is actually a true solution. One aspect of the problem required that you check each 3-by-3 box to see if the numbers 1-9 were present.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions