Suppose we have a square matrix: int matrix[n][n], where n>0. Can you briefly describe what the code below does (word li

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

Suppose we have a square matrix: int matrix[n][n], where n>0. Can you briefly describe what the code below does (word li

Post by correctanswer »

Suppose we have a square matrix: int matrix[n][n], where n>0.
Can you briefly describe what the code below does (word limit:
100)? You may use an example and draw a figure to illustrate your
idea if you want.
Suppose We Have A Square Matrix Int Matrix N N Where N 0 Can You Briefly Describe What The Code Below Does Word Li 1
Suppose We Have A Square Matrix Int Matrix N N Where N 0 Can You Briefly Describe What The Code Below Does Word Li 1 (21.16 KiB) Viewed 86 times
for (int x = n-1; x > -1; x--) { for (int y = 0; y <n; y++) { if (x < n-1 && y > 0) { matrix [x][y] += std::min (matrix [x+1] [y], matrix [x] [y-1]); } else if (x < n-1) { matrix [x][y] += matrix [x+1] [y]; } else if (y > 0) { matrix [x][y] += matrix [x] [y-1]; } std::cout << matrix [0] [n-1] << std::endl;
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply