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

maverick 7Dec2006 01:46

linked list
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

Re: linked list
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

Re: linked list
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

Re: linked list
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

Re: linked list
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

Re: linked list
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

Re: linked list
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

Re: linked list
did u understand what my problem is?do u have any idea to do this with linked list?(it is not important to do with singly,doubly,two dimensional linked-list)

DaWei 14Dec2006 23:05

Re: linked list
I understand exactly what you want to do (and can do it forty-leben different ways). The problem seems to be that you don't. That's the part you need to tackle. We all understand that you have a matrix. It's unlikely that we're going to do your assignment for you. You devise a scheme, you write some code, and you post where you're having problems. Then it's our turn to volunteer our efforts.

All times are GMT +5.5. The time now is 11:14.