Algorithm Of Traversal Of An Array
It is an operation in which element of the array is visited. The travel proceeds from first element to the last element of the array.
Example List[N] of N elements
Since the size of List is N , a count[ counter] will have to be maintained to keep track of the number of elements visited.
let C is a variable for count and initialize to 1 that is lower bound of LIST.
With every visit the count C is incremented and matched with upper bound N of LIST
if C is less than or equal N then the steps are repeated otherwise algorithm stops.
Algorithm step :
2. Process LIST[C]
3. C= C+1
4. if (C<=N) then repeat 2 and 3
Example: An array MARKS . Write an algorithm which adds value 10 to every element of array MARKS.
4. If(C<=30) then repeat 2 and 3 steps.