Pseudocode, like step-form, is a written way of stating algorithms but uses a much more restricted vocabulary. It is very much like a 3GL and for many programmers and program designers is the preferred way to state algorithms and program specifications. Pseudocode is a written statement of an algorithm using a restricted and well-defined vocabulary.
18. List the pseudocode statements for input, output, iterate, decision, and processing.
Input: READ;Output: DISPLAY;
Iterate: REPEAT statement UNTIL
Decision: IF
Processing: ADD, SUBTRACT, COMPUTE, SET
19. Use math, relational, and logical operators in pseudo-code.
Algorithm (arrayMax(A, n))
curMax = A[0]
for i=1 i < A[i]
curMax = A[i]
return curMax
curMax = A[0]
for i=1 i < A[i]
curMax = A[i]
return curMax
2n + 2
• n=5 -> 12
• n=100 -> 202
• n=1,000,000 -> 2,000,002
• n=5 -> 12
• n=100 -> 202
• n=1,000,000 -> 2,000,002
20. Use subprocess/subroutines/functions in pseudo-code.

No comments:
Post a Comment