📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      For a sparse matrix, which representation method is

      generally preferred to save memory and improve computational efficiency?
      A Storing it as a dense 2D array Correct Answer Incorrect Answer
      B Using a linked list of non-zero elements (e.g., triplet representation) Correct Answer Incorrect Answer
      C Storing only the diagonal elements Correct Answer Incorrect Answer
      D Converting it to a hash table Correct Answer Incorrect Answer
      E Storing it as a single 1D array Correct Answer Incorrect Answer

      Solution

      Sparse matrices are efficiently represented by storing only their non-zero elements, often using a triplet format (row, column, value) or a linked list structure, which significantly reduces memory usage compared to a dense 2D array.

      Practice Next
      ask-question