The Summation Of Boundary Elements



Algorithm 2.8: Algorithm to find the summation of boundary elements
1. Input: A[1…m, 1…n], sum = 0;
//a two-dimensional array and a variable
2. Find each boundary element
for (i = 1; i ≤ m; i = i + 1)
for (j = 1; j ≤ n; j = j + 1)
if (i = 1 || j = 1 || i = m || j = n),
sum = sum + A[i, j];
[Boundary elements are those elements whose index i = 1 or j = 1, and those whose index i = m or j = n) and add it with sum (previous result)]
3. Output: Print sum as the result of summation of boundary elements



Back

4 comments:

  1. thank you
    it was of gr8 help

    ReplyDelete
  2. Anonymous09:28

    very nice.....

    ReplyDelete
  3. Anonymous07:11

    Thankz a lot bro...

    ReplyDelete
  4. Anonymous04:21

    Thnks a lot

    ReplyDelete

There was an error in this gadget

Followers

About Me

Dhaka, Dhaka, Bangladesh
..