55 votes 55 votes An $n \times n$ array $v$ is defined as follows: $v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$ The sum of the elements of the array $v$ is $0$ $n-1$ $n^2 - 3n +2$ $n^2 \frac{\left(n+1\right)}{2}$ DS gatecse-2000 data-structures array easy + – Kathleen asked Sep 14, 2014 edited Oct 26, 2016 by go_editor Kathleen 9.8k views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments shashankrustagi commented Dec 6, 2020 reply Follow Share misprint in GO pdf 1 votes 1 votes sgsudhir commented May 17, 2021 reply Follow Share In question, it is given as 1 <= j <= n, means range of j is from 1 to n. And i <= n, means what is the range of i here? I mean i value can be ‘0’ also, i.e. range of i can be 0 to n-1 also. Any suggestion please 0 votes 0 votes rhl commented Sep 20, 2021 reply Follow Share And i <= n, means what is the range of i here? I mean i value can be ‘0’ also, i.e. range of i can be 0 to n-1 also. 1<= j <= n( which represents column number) as given in question. Now look at the first element of a 2-D array, it should be either at (0,0) or (1,1) according to the convention chosen, but here j should be greater than 1, so the possibility of using (0,0) is ruled out. We have to use the convention in which first element of the 2-D array is at (1,1). Using (0,1) makes no sense here. 1 votes 1 votes Please log in or register to add a comment.
6 votes 6 votes sum of all elements =n*( $\sum_{i=1}^{n}i-\sum_{j=1}^{n}j )= 0$ Niraj Singh 2 answered Dec 10, 2017 Niraj Singh 2 comment Share Follow See all 0 reply Please log in or register to add a comment.
4 votes 4 votes ans is option (a) i.e 0 solution: suppose if n=3 then i<=3 and 1<=j<=3 i.e i=1,2,3, and j=1,2,3 => v={i-j}=(0,-1,-2,1,0,-1,2,1,0} sum of elements in v=0 prakash answered Nov 17, 2014 edited Nov 17, 2014 by prakash prakash comment Share Follow See 1 comment See all 1 1 comment reply Sahil1994 commented Jan 15, 2018 reply Follow Share @prakash What if i take, i=0,1,2. and j=1,2,3...? then it will be skew symmetric matrix..? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Answer is Option----A Assume n=2; then the condition is i<=2 and 1<=j<=2 now the values are i={1,2} and j={1,2} Given, v[i] [j]= i-j; now the values will be v ={1-1,1-2,2-1,2-2}; v={0,-1,1,0}; sum of all values present in v is 0.. Sainikhil_avula answered Jul 31, 2020 Sainikhil_avula comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes An n x n array v is defined as follows: v[i, j] = i - j for all i, j, 1 < i < n, 1 < j < n.The sum of the elements of the array v is. 0. ( A ) IS ANSWER Rahul_kumar3 answered Oct 18, 2023 Rahul_kumar3 comment Share Follow See all 0 reply Please log in or register to add a comment.