I have some confusion in:
for i = 1 to n
does this pseudocode code means for(i=1; i<n; i++) or for(i=1; i<=n; i++) ?
And if one from them, then what will be the pseudocode for another one?
It should be understood to include an iteration where i takes the value of n.
However, there are no strict rules for pseudo code, and so in case there is doubt about an actual piece of pseudo code, then this means that code didn't achieve what it was supposed to do: unambiguously describe an algorithm without any programming language in mind.
Here are some of the arguments why it should be understood to include n:
to keyword in a for loop syntax, where the value that follows to is not to be included in the iterations. On the other hand, BASIC like languages (such as vba) have that syntax, and the "to" value will be used for the final iteration.to keyword is used, the final iteration is using that value.n elements (a very common case), then there is no ambiguity: for i = 1 to n tells us that the array's first element has position 1, and hence its last position is position n. It is not uncommon to use such 1-based indexing of arrays in pseudo code, as this is more intutive to non-programmers. If however in such array context you see for i = 0 to n in pseudo code, some alarms should go off. That definitely would come across ambiguous.It is highly contextual and depends on the person who wrote it. (It also kind of depends on the programming language that the pseudocode is aimed to be converted to.)
If it were in an interview setting, it might be a good idea to ask if this is "inclusive of n or not". Because it could be either case.
(I know this answer might not be that helpful. Sorry about that, but it doesn't seem that this has a definitive answer.)
for (i=1; i<n; i++) or for (i=1; i<=n; i++) instead of using pseudocode for that part.1 to n in pseudocode to mean not including n? I would think it always means including n, I would not expect a credible textbook or other authoritative source to write 1 to n without meaning to include n.for ... to ... loop is not a common programming language [loop] option (as pointed out by @trincot in their answer). I agree that it would make sense for this kind of loop to be inclusive (from a linguistic standpoint). But it's still possible for it to be misunderstood by some. So it might be the best idea to be clear about its functionality.
nincluded. Obviously that means you'll have to doto n-1if you don't want that.