by BehindJava
How to write pseudo code for traversing multi dimensional arrays and how to reference a array instance in pseudo-code
This is quick tutorial about writing the pseudo code for traversing multi dimensional arrays.
Traverse ( ):
Description: Here A is a two – dimensional array with M rows and N columns. This algorithm traverses array A and applies the operation PROCESS to each element of the array.
- Repeat For I = 1 to M
- Repeat For J = 1 to N
- Apply PROCESS to A[I][j]
[End of Step 2 For Loop]
[End of Step 1 For Loop] - Exit
Explanation: The first for loop iterates from 1 to M i.e. to the total number of rows and the second for loop iterates from 1 to N i.e. to the total number of columns. In step 3, it applies the operation PROCESS to the elements of the array A.