🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.ai
Article #8857

Re: m-way tree building

#8857
From: Irwin M. Fargo
Date: Sun, 11 Feb 1990 22:24
38 lines
1491 bytes
In article <8053@cbnewsh.ATT.COM> skumar@cbnewsh.ATT.COM (swaminathan.ravikumar) writes:
>
>I have the following facts asserted in the prolog database:
>
>	linked(a, b).
>	linked(a, c).
>	linked(b, d).
>	linked(b, e).
>	linked(b, f).
>
>and I want to construct an "m-way" tree strcuture as follows:
>
>		a
>		|
>	     -------
>	     |     |
>	     b     c
>	     |
>           -----	   
>	   | | |
>	   d e f
>

Instead of using Prolog predicates to link the elements, you might want to
use Prolog lists.  The book I used when learning Prolog (Knowledge Systems
& Prolog, edited by Adrian Walker), showed how lists can be interpreted as
a tree structure.  You might want to take a look at a good text on Prolog.

You can also create n-way trees in languages like C and Pascal by using
linked lists.

Hope this helps.

-- 
Thank you and happy hunting!             Actually: Ethan M. Young
  ____ [> SB <]    "Travel IS life"      Internet: fargo@pawl.rpi.edu
 /__   -=>??<=-       - Irwin M. Fargo   Bitnet (??): usergac0@rpitsmts.bitnet
/   ARGO : 3000 years of regression from the year 4990
Technical Details
Message-ID: <D?88P-@rpi.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!rpi!fargo
References: <8053@cbnewsh.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!rpi!fargo
From: fargo@pawl.rpi.edu (Irwin M. Fargo)
Newsgroups: comp.ai
Subject: Re: m-way tree building
Keywords: m-way trees
Message-ID: <D?88P-@rpi.edu>
Date: 11 Feb 90 22:24:29 GMT
References: <8053@cbnewsh.ATT.COM>
Organization: Fargo HQ, Inc.
Lines: 38