Talk:Data Structures/Introduction

In the second example of "Building a Chain from Nodes" nodes are created while intergers are input, then the nodes are iterated over in a while loop. Inside the loop, the current node value is accessed--get-value(nodes)-- then the nodes object is updated--nodes := get-next(nodes)--.

It seems the while loop would exit after the first iteration as the nodes reference is still the last item added and the get-next(nodes) call would return a null. I would have expected to a reference to the first item stored and the nodes object reset to this original reference before the while loop in question was entered. Is this a typo or am I missing an obvious concept?


 * The last item added is the front of the list, not the back of the list. I thought about perhaps having some "head" pointer and a tail pointer, but that might be more complicated than this way. MShonle 14:31, 6 Jan 2005 (UTC)


 * Thank you, that completly clears up my confusion. I looked at the example for a long time, but missed that the first item in the list starts off with a null reference and all further items reference the previous item. I just couldn't see it. Thanks for the prompt feedback and the great resource.

In this section, the book makes reference to the term "node" as a data type, but isn't singly linked list the more technically correct term? I always thought a linked list was made up of nodes, but the data structure itself was called a linked list.

In the list of node operations is set-next method with return value Node. But in the implementation, there is no return value. set-next is used in the example where data are stored in not reversed order. According to this example, set-next should return Node that has been set as next in original Node.


 * I'm thinking the exact same thing. "nodes := set-next (nodes, make-node (i, null)) // append new node to the end of the list" makes no sense in this context, and the current program would malfunction by dropping all but the last two inputs. Also, the line's comment contradicts the discussion above, in which it is stated that the list should be created in reverse order. I'd also add that the implementation smells of bad design: when making a custom data structure for this, why make it mutable? There's no reason to even allow forward creation, since the problem is order-independent. The code becomes longer and harder to reason about for no apparent benefit. 79.225.193.139 (discuss) 13:35, 19 August 2014 (UTC)

I'm introducing a paragraph in the introduction that explains big-oh notation. I think most people are oblivious to the notation until they start studying data structures and a quick explanation is valuable, especially before it's used in the node structure. I'm also a little confused about the organization. Shouldn't nodes be introduced after arrays since they lead into lists so nicely? Christopher.Reilly (discuss • contribs) 00:09, 15 June 2015 (UTC)