[Tutor] Making Doubly Linked List with Less Lines of Code.

Danny Yoo dyoo at hashcollision.org
Thu Dec 25 06:31:06 CET 2014

On Wed, Dec 24, 2014 at 1:35 PM, WolfRage <wolfrage8765 at gmail.com> wrote:
> I wrote some code recently to make a linked list of Nodes for a 2d graph, so
> it consists of rows and columns. Now I wanted to make the code support being
> doubly linked, forwards and backwards.

What are the _operations_ you want to support?  Can you say more about this?

Representations make certain operations easier or more difficult, and
you're focusing on representations, which is fine.  But I'm not quite
sure what operations you need to support.

You mention the concept of a 2d graph arranged in rows and columns.  I
am assuming you want at least two operations.

* Given a row and column, add a Node at that position.
* Given a row and column, get the Node (or nodes?) at that position.

Conceptually, these are "insertion" and "lookup".  But note that I am
not sure what you want out of "lookup".  I can't tell because it's not
obvious, so you need to let us know.

Does that sound reasonable?  Let's put a stake on the ground and nail
purpose first.  And then figure out representation after that.

More information about the Tutor mailing list