🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.pascal
Article #3

Re: Help with Pascal program

#3
From: Dave Seaman
Date: Fri, 15 Nov 1985 14:00
45 lines
1996 bytes
In article <2047@aecom.UUCP> rgross@aecom.UUCP (Ronald Gross) writes:
>I need help with the following tree program.  I don't want to write 
>any more tree programs.

At least not until you find out what your next programming assignment is.

>Given the preorder and inorder traversals of a binary tree, build the tree
>and print the postorder traversal of it.
>
>Read the input read into two lists.  The tree should be built using
>pointers.

Because that's how the assignment was described on your handout.  Why else
would you care how the tree is built?

>The algorithm goes like this.  Given LIST1 (preorder) and LIST2 (inorder).
>The first node of LIST1 is the root of the tree.  This node is in the
>middle of LIST2, and partitions it into left and right sublists.  LIST1 is
>then partitioned into sublists.  Apply this recursively.
>
>Please have the program echo the input, use lots of routines (makes for
>easier reading.

Also for better grades.  Don't forget to indent nicely and use lots of
comments to please the grader.

>Thanks alot.  Oh yeah, here's some test data.
>
>LIST1		LIST2
>-----		-----
>
>A		A
>ABDEHCFGI	DBHEAFCGI
>BCA		ABC		(this will give an error)
>
>
>	Thanx alot folks.  Your help is appreciated.
>
>				Ronny

Sure thing.  When is the assignment due?


-- 
Dave Seaman			 ..!pur-ee!pucc-h!ags
Technical Details
Message-ID: <2445@pucc-h>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!pucc-j!pucc-h!ags
References: <206@ur-tut.UUCP> <2047@aecom.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 alpha 4/15/85; site pucc-h
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!pucc-j!pucc-h!ags
From: ags@pucc-h (Dave Seaman)
Newsgroups: net.lang.pascal
Subject: Re: Help with Pascal program
Message-ID: <2445@pucc-h>
Date: Fri, 15-Nov-85 09:00:25 EST
Article-I.D.: pucc-h.2445
Posted: Fri Nov 15 09:00:25 1985
Date-Received: Sat, 16-Nov-85 09:43:21 EST
References: <206@ur-tut.UUCP> <2047@aecom.UUCP>
Reply-To: ags@pucc-h.UUCP (Dave Seaman)
Distribution: net
Organization: Purdue University Computing Center
Lines: 45