Programming Assignment No. 3 Matrix Traversal Algorithms
Requirements
1. Flowchart has to be done before December 10.
2. Final programming code has to be done before December 17.
3. An algorithm has to be described in the form of flowchart. Flowchart must be drawn accordingly to the rules:
1) Each flowchart has 2 terminal symbols, “start” and “end”.
2) Symbol sizes must be consistent.
3) Flow lines must never cross.
4) It is better to separate too large flowcharts into smaller logical parts using
connector symbols, or single a sub-algorithm using a predefined symbol.
5) Only one comparison operator (<, =, >) can be put inside a branch symbol.
Problem statement
Given a 2-dimensial array (matrix) of size N×M. Input: 𝑁, 𝑀 ∈ N∗
Size of the matrix must be determined by a user. Matrix elements must be positive and be generated randomly in range [10; 99].
The matrix must be traversed accordingly to the variant. Traversal is printing out the matrix elements along the route shown in the picture.
The initial matrix must be printed out before traversal.
A traversal sequence must be printed out after traversal.
Example:
Traverse the following matrix:
The traversal sequence: 12 75 32 11 89 45 15 33 65 34 13 78 52 79 19 21 58 41 48 72 16 99 17 83 38 37 12 46 68 27 29 31 49 88 35 87 10 91 55 36
Assignment variants
Variant No.
Problem statement
1
2
3
4
5
6
7
8
9
Control questions
1. What is array?
2. What are the characteristics of an array element?
3. What are the types of array?
4. What are the main operations on array?