How many statements are executed by the original version of


Problem

One idea for speeding up the function Life :: neighbor_count(row, col) is to delete the hedge (the extra rows and columns that are always dead) from the arrays grid and new_grid. Then, when a cell is on the boundary, neighbor_count will look at fewer than the eight neighboring cells, since some of these are outside the bounds of the grid. To do this, the function will need to determine whether or not the cell (row, col) is on the boundary, but this can be done outside the nested loops, by determining, before the loops commence, the lower and upper bounds for the loops. If, for example, row is as small as allowed, then the lower bound for the row loop is row; otherwise, it is row - 1. Determine, in terms of the size of the grid, approximately how many statements are executed by the original version of neighbor_count and by the new version. Are the changes proposed in this exercise worth making?

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: How many statements are executed by the original version of
Reference No:- TGS02642857

Expected delivery within 24 Hours