[net.lang.pascal] Help with Pascal program

rgross@aecom.UUCP (Ronald Gross) (11/10/85)

I need help with the following tree program.  I don't want to write 
any more tree programs.

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.

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.

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

scco@ur-tut.UUCP (Sean Colbath) (11/14/85)

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.
>
>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.
>
>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.
>
>Thanks alot.  Oh yeah, here's some test data.
>	Thanx alot folks.  Your help is appreciated.
>				Ronny

Why does this sound suspiciously like someone's Data Structures assignment?

-Sean Colbath

"Dave, why don't you take a stress pill and lie down for a while?"
UUCP:    {allegra,decvax,ihnp4}!seismo!rochester!ur-tut!scco
BITNET:  SCCO@UORVM

michael1@ihlpm.UUCP (Pula) (11/14/85)

> I need help with the following tree program.  I don't want to write 
> any more tree programs.
> 
> 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.
> 
> 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.
> 
> 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



    YOU'VE GOT TO BE KIDDING!  OK folks, let's all help Ronny with
    his homework assignment.  Geez Ron, couldn't you even try to 
    start it out?  This is what I'd really call chutzpah!


-- 

Mike
!ihnp4!ihlpm!michael1

ags@pucc-h (Dave Seaman) (11/15/85)

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