![]() ![]() For example, if you are given a problem such as person 1 is x years old, person 2 is y years old, and so on, indexing using the given numbers may make it easier to give an answer if asked something such as who is the youngest person in the list. Starting at i = 1 is more natural for modeling many problems while designing algorithms. Our minds become use to working in this style. Personally I would say I use this style at least 90% of the time, as when modelling problems in the computer we mold them to use built in data structures, which usually start at 0. You should use i = 0 in situations where iterating starting at zero would be natural, as previously stated this could include array indexing or similar. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |