![]() |
|
[Java] Don't really understand how matrix's work - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Don't really understand how matrix's work (/showthread.php?tid=5724323) |
Don't really understand how matrix's work - Autowall - Sep 24, 2017 Prepare a matrix codes that picks a row (it does not necessarily have to be the first row), moves it to the top of the matrix, and turns the first number into a 1, using only the three allowed matrix operations. (Don't forget, you cannot turn a 0 into a 1, but any other number is fair game.) I am doing my homework assignment and really don't understand the logic behind it. If anyone can help me with this I would appreciate it. It really doesn't have to be a full working code. * - MadZ - Sep 25, 2017 Here's the logic behind it. 1) Start with some matrix (I will be using the following 3x3 matrix): int[][] matrix: 3 5 6 9 2 4 9 4 6 2) Pick any row to be moved to the top (I'll be using row 2): 3 5 6 => 9 2 4 9 2 4 => 3 5 6 9 4 6 => 9 4 6 3) Check if first number is != 0, change to 1 (9 != 0): 1 2 4 3 5 6 9 4 6 What are the matrix operations you're allowed to use? RE: Don't really understand how matrix's work - Marduno - Nov 24, 2017 Matrix is simply a 2D array. |