Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)

 maverick 7Dec2006 01:46

i need to read matrix and i have to use linked list.for example how can i implement 4*5 matrix with two dimensional linked list?thanks for ur help

 shabbir 7Dec2006 11:16

You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

Also if you search for Linked List you will find lots of code to explore.

 DaWei 7Dec2006 21:22

A linked list is a degenerate form of a tree. If you make a linked list (which is linear) multidimensional, it ceases to be a list. It could be either a tree or a graph. If you want more help, you're going to have to be more specific. My crystal is in the shop for ball joints.

 maverick 14Dec2006 19:35

for examle i have to read 3*3 matrix from txt file like 4 5 2
3 3 5
2 1 6
and do some operations like add new row,column,delete row,column.i decide to use doubly linked list.For examle 4(which is first element of matrix) have two links which are show next and below node.how can i do this??

 DaWei 14Dec2006 20:31

Your terminology is incorrect. A doubly-linked list is a structure in which each node has a pointer to the next node and to the previous node. As I mentioned in my previous post, what you are describing is a tree. For instance, a binary tree node has pointers to two children. This does not make it a doubly-linked list. Perhaps if you directed your efforts toward trees, rather than linked lists, you would have a clearer view of your problem and its requirements. If someone has imposed upon you the requirement of using a linked list, then I'd suggest you use an array or vector of linked lists. You could also use one form of a general tree. In a general tree a node has a pointer to a child; the siblings of a child are pointed to by the child, and are essentially a linked list. Each node in the list, however, is a general tree node which can also point to it's primary child. In a situation such as your matrix, you are redefining the tree structure such that a node may have multiple children, and children may have multiple parents. I have done this with some game trees, but one can easily get into some serious conceptual and implementation issues.

 maverick 14Dec2006 20:44

when we think matrix cant i do that each node points to the next node and below node?cant u understand that what i want to say for below node?why cant i use below node instead of prev node?thanks for dealing;)

 DaWei 14Dec2006 20:50

I'm not saying you can't do what you propose. I'm saying you are incorrect in referring to it as a doubly-linked list. It is not. Your unfortunate misuse of terminology causes your potential respondents to go off on a tangent and offer help for what you SAID, not for what you WANT.

I recommend that you take a few minutes to clarify your thinking so that you can formulate your request effectively, without misinformation that sidetracks the process. Information (correct information) is key. You might also want to read Smart Questions.

 maverick 14Dec2006 21:05