Friday, December 12, 2014

Activity 1.3.7 For Loops


Sometimes code using an iterative loop can be written without a loop, simply repeating the iterated code over and over as separate lines in the program. Explain the disadvantages of developing a program this way.

The disadvantages of repeating the iterated lines of code multiple times is the fact that the coder loses both time and efficiency. Also if an error were to occur somewhere in the program, it would be more difficult to find the erroneous line of code because there would be so many more to choose from as opposed to using loops.

Name a large collection across which you might iterate.

One example of a large collection across which one might iterate is a collection of books. In this, the program would have the list of all of the books, and would function with iterations to search for one specific book based on the input that the user has entered.

What is the relationship between iteration and the analysis of a large set of data?

Iteration is used in the analysis of a large set of data in the fact that it goes through the list of data to find a specific key, element, line, or whatever is needed in that particular code. Thus, iteration is a very helpful and beneficial method in analyzing a large set of data. If there was no iteration, searching a list of integers for one specific integer would be time consuming, so luckily iteration is around to ease the coding and lessen the time of work for the programmers.

No comments:

Post a Comment