braso Posted November 10, 2012 Share Posted November 10, 2012 Hi guys. I need some help on constructing an algorithm. The question is: Derive an algorithm to store the elements of a table with size n by n in a computer memory using row major. Obtain the elements of the table by: 1. Row 1 Column 1 has the value 1; obtained by (1*1) 2. Row 2 Column 6 = 12 (2*6) 3. Row m Column n = mn (m*n) All help will be gladly accepted and appreciated. Thanx! Link to comment Share on other sites More sharing options...
phillip1882 Posted November 11, 2012 Share Posted November 11, 2012 umm, that doesn't quite make sense. if row m column n = n*m then row 3 column 4 = 12 and row 2 column 6 = 12 and row 1 column 12 = 12 do you see the problem? i believe the standard algorithm is something like the following: linear value = row*total columns +column. Link to comment Share on other sites More sharing options...
Ben Banana Posted November 11, 2012 Share Posted November 11, 2012 (edited) i believe the standard algorithm is something like the following: That's not an algorithm anyway. I hate these stupid CS-homework questions from people who are in the wrong place. Edited November 11, 2012 by Ben Bowen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now