caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Creating a tree type
Date: Wed, 9 Feb 2005 17:28:32 +1300	[thread overview]
Message-ID: <ad8cfe7e0502082028bd9caeb@mail.gmail.com> (raw)
In-Reply-To: <200502071601.01981.jon@jdh30.plus.com>

On Mon, 7 Feb 2005 16:01:01 +0000, Jon Harrop <jon@jdh30.plus.com> wrote:
> On Monday 07 February 2005 11:41, Jonathan Roewen wrote:
> > What would be the best approach to creating a tree type such that at
> > each node, it has some sort of reference to the parent node...
> 
> Adding references to the parent of each node in a tree makes the data
> structure a graph and not a tree.
> 
> This can be implemented in several ways. However, I strongly recommend that
> you do not do this to begin with, for several reasons:

Okay, so I realised I could just use a Stack to track a walk through the tree...

A couple more questions though:

1. For the Stack, when I put something in it, is it copied or what?
How does that work?

2. How do I make my tree like a hashtable, i.e. modifications are done
in-place? Some sort of nested Map or something? Using lists to build
up the tree would cause pain when wanting to modify it. It would also
seem inefficient to use lists for this particular use case.

Regards,

Jonathan.


  parent reply	other threads:[~2005-02-09  4:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-07 11:41 Jonathan Roewen
2005-02-07 11:58 ` Richard Jones
     [not found] ` <200502071601.01981.jon@jdh30.plus.com>
2005-02-09  4:28   ` Jonathan Roewen [this message]
2005-02-09  6:43     ` Pierre Casteran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad8cfe7e0502082028bd9caeb@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).