0
Representing a matrix
I wonder how I can represent a matrix using linked lists in a way that I can loop through the columns/rows easily What I have intended now is: I have a class Node(self, value, right, down): Where right represents the columns and down rows Then I have another class Matrix(self, numrows, numcols, defaultvalue=0) How can I represent it so that i can easily set a value a given row and column, or get a specific row with its values? Thanks!
2 odpowiedzi
+ 6
Why would you want to do that? Frankly inefficient way of manipulating a matrix.
+ 1
It is, but it's at the same time a great way to practice and know more about linked lists.
An easier approach would be creating a list inside a list, but it would end up using too much space as compared to linked lists