recategorized by
28,174 views
75 votes
75 votes

In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the $(i, j)^{th}$ element of the lower triangular matrix in this new representation is:

  1. $i+j$
  2. $i+j-1$
  3. $(j-1)+\frac{i(i-1)}{2}$
  4. $i+\frac{j(j-1)}{2}$
recategorized by

11 Answers

0 votes
0 votes
$\begin{bmatrix} (0,0)& (0,1)& (0,2)& (0,3)\\ (1,0)& (1,1)& (1,2)& (1,3)\\ (2,0)& (2,1)& (2,2)& (2,3)\\ (3,0)& (3,1)& (3,2)& (3,3) \end{bmatrix}$

 

1D array for lower triangular matrix : $\begin{bmatrix} (0,0) & (1,0) & (1,1) & (2,0) & (2,1) & (2,2) & (3,0) & (3,1) & (3,2) &(3,3) \end{bmatrix}$

 

Now check for options:

index=3 i.e. (2,0) doesn't satisfy option A (index=i+j)

index=0 i.e. (0,0) doesn't satisfy option B (index=i+j-1)

index=0 i.e. (0,0) doesn't satisfy option c (index=ij-1+i(i-1)/2)

index=2 i.e. (1,1) doesn't satisfy option B (index=i+j(j-1)/2)

 

i think no options are correct
Answer:

Related questions

29 votes
29 votes
6 answers
11
Kathleen asked Oct 5, 2014
4,974 views
An array $A$ contains $n$ integers in non-decreasing order, $A \leq A \leq \cdots \leq A[n]$. Describe, using Pascal like pseudo code, a linear time algorithm to find $...
35 votes
35 votes
4 answers
12
Kathleen asked Oct 4, 2014
23,085 views
Linked lists are not suitable data structures for which one of the following problems?Insertion sortBinary searchRadix sortPolynomial manipulation
33 votes
33 votes
6 answers
13
Kathleen asked Oct 4, 2014
33,353 views
Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence $\text{1, 2, 3, 4, 5}$ in that...