题目详情

设某n阶三对角矩阵Anxn的示意图如下图所示。若将该三对角矩阵的非零元素按行存储在一维数组B[k](1≤k≤3×n-2)中,则k与i、j的对应关系是( )。

中级软件设计师,模拟考试,2021年软件设计师模拟题4

  • A.k=2i+j+2
  • B.k=i-j+1
  • C.k=3i+j-2
  • D.k=2i+j-2

正确答案及解析

正确答案
D
解析

本题考查数据结构基础知识。解答该问题需先计算排列在Ai,j之前的元素个数。在按行存储方式下,存储在Ai,j之前的元素分为i-1行,除第1行外,每行3个元素。在第i行上,Ai,j之前的元素个数分为三种情况:i>j时为0个,i=j时有1个,i<j时为2个,概括为j-i+1个。综上,排列在Ai,j之前的元素个数为(i-1) ×3-1+j-i+1,即2i+j-3。由于数组B的下标从1开始,所以k=2i+j-3+1。

包含此试题的试卷

你可能感兴趣的试题

单选题

Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.

  • A.Artificial Intelligence
  • B.Cloud Computing
  • C.Internet of Things
  • D.Big Data
查看答案
单选题

In project human resource management , ( )is not a source of power for the project manager.

  • A.referent power
  • B.expert power
  • C.reward power
  • D.audit power
查看答案
单选题

At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.

  • A.detail feasibility analysis
  • B.opportunity analysis
  • C.economic feasibility analysis
  • D.risk analysis
查看答案
单选题

( )is a grid that shows the project resources assigned to each work package.

  • A.Stakeholder engagement assessment matrix
  • B.Requirements traceability matrix
  • C.Probability and impact matrix
  • D.Responsibility assignment matrix
查看答案
单选题

Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.

  • A.digital
  • B.networking
  • C.intelligentize
  • D.informatization
查看答案

相关题库更多 +