From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,5d80f40bdd51947e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-11-03 08:47:07 PST Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!skynet.be!freenix!wanadoo.fr!not-for-mail From: "Franck" Newsgroups: comp.lang.ada Subject: Re: binary tree and files Date: Fri, 3 Nov 2000 17:47:42 +0100 Organization: Wanadoo, l'internet avec France Telecom Message-ID: <8tuq67$lqj$1@wanadoo.fr> References: <8tuk7l$aq5$1@wanadoo.fr> <8tul32$c3p$1@wanadoo.fr> <3A02DF9B.2269@global2000.net> NNTP-Posting-Host: aannecy-101-1-57.abo.wanadoo.fr X-Trace: wanadoo.fr 973270023 22355 193.251.22.57 (3 Nov 2000 16:47:03 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 3 Nov 2000 16:47:03 GMT X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Xref: supernews.google.com comp.lang.ada:1752 Date: 2000-11-03T16:47:03+00:00 List-Id: Arthur G. Duncan a �crit dans le message <3A02DF9B.2269@global2000.net>... >Franck wrote: > > ... question on how to save and restore a binary tree of the > form: > >> type T_node; >> type Pt_tree is access T_Node; >> >> type T_Node is record >> name : T_name; >> G, D : Pt_tree; >> end record; >> > >If it is, indeed, a tree (no cycles), you can simply write it out >as a set of nested tuples (LISP list notation is as good a form >as any). > >If there are cycles (or the tree is reentrant and you want to save >disk space) you can label the nodes and write out label references >wherever you have a pointer in the original data structure. > >Hope this helps, > >- Art Duncan > aduncan@global2000.net thanks for the help Duncan, but i'm new to Ada and recursivity, and i don't understand all you speek about ;o) what is a set of nested tuples?? there is no cycle i think in my program it s to make a genealogic tree,like this : father father has 2 children : child1 and child2 / \ / \ null child1 child1 has no child / \ / \ child2 null child2 has 2 children : little child1 and little child2 / \ / \ null little child1 little child1 has no child (right) and one brother(left) / \ / \ little child2 null little child2 has no other brother and no child / \ / \ null null i can easily save that in a files with recursive procedure, but i don't see how to load it from files still in need of help ;o) Franck