Hi everyone, thanks in advance for taking the time to read and respond to this post. To be clear this is part of a University course I am doing so I'm not looking to cheat or 'blag' the answers from others! Quite simply we have no support or guidance and I'm a fairly novice programmer so I was hoping to post the question here where some of the more experienced programmers may offer some advice or guidance.
One example given is:An unstructured sparse matrix is simply a matrix where a significant number of elements are zero.
Using a suitable in-memory data structure that stores only non-zero elements, it is possible to
represent such a matrix in a much more compact way than a dense equivalent (where all elements
are stored whether zero or not).
1. Implement a data structure that can represent a sparse matrix. It is essential that the data
structure is space efficient since your solution will be tested with matrices whose
dimensions are many orders of magnitude larger than those provided.
2. Implement functions that enable an in-memory instance of the sparse matrix data structure
to be read from or written to an on-disk file as per the format above.
Although It does not suggest this is the best or preferable way forward.5,5
represents a (5 x 5)-element matrix M =
-1 0 0 0 2
0 5 0 6 0
0 0 7 0 0
0 8 0 9 0
3 0 0 0 -4
I'm not particularly well versed on data structures but I remember sorting data and writing it to a linked list by building it node by node last year and I'm wondering if a linked list could be a useful data structure to start with??
This is just Part of stage 1 and there are 5 stages. Later on I will have to compute the sum, product etc.. I thought this might be important to bring up in case this affects my choice of data structure.
Thanks again - as you can probably tell I'm a little lost.Although there may be multiple valid approaches at each stage, your solution should aim to be as efficient as possible
wrt. execution time. Within reason, a trade-off favouring time over space is encouraged.