Relative Content

Tag Archive for loops

2 Dimensional Arrays in C++

I started learning arrays in C++ and came over a little side note in the book talking about 2D arrays in breif.

Loop invariant vs Assertions

I have an exam on Programming Concepts this Saturday and I am struggling to find some information to understand some concepts better.

Loop Invariants in Python

I have a bit of experience with loop invariants but I’m not really clear on them. I’m trying to learn them through an example in Python. Can someone point one out or help me understand?

Declaring functions in order to avoid explicit nested loops

My programming professor has told me that it is a good programming practice (at least in C/C++) to declare a function with the inner loop when nesting loops (not for loops, since when, i.e. looping through a multidimensional array this is very intuitive). For example, if I write