Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Find out about Online Training
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 11 Professional
Maple 11 Academic
Maple 11 Student Use
Recorded Online Seminars
FREE Training Resources


MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

View Maple 10 in Action
Product Comparison Chart

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple 10 Training Videos
MaplePrimes, blogs, forums
Elite Maintenance Program
Application Centre
Powertools
Maple User Group (MUG)
Join the Maple User Group
(MUG)

Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Binary Tree Data

Search email archive for  

[MUG] Binary Tree Data
Author: Maple User Group    Posted: Mon, 17 Feb 2003 22:15:46 -0500

>> From: Maple User Group "maple_gr"

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Sat, 15 Feb 2003 04:38:03 -0500 (EST)
From: Carl Devore "devore"
To: "maple-list"
Subject: Binary Tree Data Structure



On Mon, 3 Feb 2003, Bruno Guerrieri wrote:
> I am trying to use Maple to set up binary trees and work with them.

See ?examples,binarytree

> Since speed is not paramount to what I am doing, is there a
> "construct", (be it artificial and to be refined in future versions),
> a definition-like "thing" that someone could set up at the beginning
> of the worksheet that would allow one to almost translate word for
> word certain C procedures such as node deletion in a tree, exploiting
> the recursive nature of the situation. The construct would, of course,
> be the equivalent of the pointer concept p->left or p->right as one
> can see in the following example:

Yes, they are called modules (see ?module), and as far as I can tell,
there is no performance penalty for using them. The Maple syntax would be
p:-left rather than C's p->left.

A skeleton would be
BinaryTree:= proc(...)
module()
export left, right, ...;
left:= ...;
right:= ...;
...
end module
end proc;

p:= BinaryTree(...);
p:-left;

Note that a procedure that returns a module (as above) is far more
powerful than just a module.


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: "Dr Francis J. Wright" "F.J.Wright"
To: "bruno.guerrieri"
Subject: Binary Tree Data Structure
Date: Sun, 16 Feb 2003 17:12:28 -0000

From: "Bruno Guerrieri" "bruno.guerrieri"
To: "maple-list"
Sent: Monday, February 03, 2003 10:52 PM
Subject: [MUG] Binary Tree Data Structure


> I am trying to use Maple to set up binary trees and work with them. Is =
> there a person in the community who has already written the standard =
> procedures for insertion, deletion of nodes etc.. and would not mind =
> sharing?
>
> In addition, although I do not want to go the route of C, C++, etc, the =
> concept of pointer is especially useful when dealing with trees. Since =
> speed is not paramount to what I am doing, is there a "construct", (be =
> it artificial and to be refined in future versions), a definition-like =
> "thing" that someone could set up at the beginning of the worksheet that =
> would allow one to almost translate word for word certain C procedures =
> such as node deletion in a tree, exploiting the recursive nature of the =
> situation.=20
> The construct would, of course, be the equivalent of the pointer concept =
> p->left or p->right as one can see in the following example:
>
> Here is an example of a C procedure
> void printtree(node *p)
> { if (p !=3D NULL)
> { printtree(p->left);
> printf(........,p->count, p->pword);
> printtree(p->right);
> }
> }


You might like to take a look at C:\Program Files\Maple
8\examples\binarytree.mws (although the full pathname of this file may be
different on your installation), which illustrates insertion, deletion, etc.
There is also a similar implementation of linked lists described in the
Maple 8 Advanced Programming Guide. These both use inert functions to
represent nodes.

Alternatively, if you represented a node as a module (or record) then you
could use the object-oriented syntax node:-left etc, which is as close as I
think you will get to C pointer syntax.

Francis


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: "Thomas Richard" "t.richard"
To: "maple-list"
Subject: AW: Binary Tree Data Structure
Date: Mon, 17 Feb 2003 09:37:48 +0100

> >> From: "Bruno Guerrieri" "bruno.guerrieri"
>
> Dear MUG
>
> I am trying to use Maple to set up binary trees and work with them. Is =
> there a person in the community who has already written the standard =
> procedures for insertion, deletion of nodes etc.. and would not mind =
> sharing? [...]

I guess ?examples,binarytree has most of what you need.

--
Mit freundlichen Gruessen / best regards
Thomas Richard Tel.: +49-241-40008-52, Fax: -13
Maple Support "mailto:maple.support"
Scientific Computers GmbH <http://www.scientific.de>

Previous by date: [MUG] What has MAPLE 7 against MMA 3, Maple User Group
Next by date: [MUG] differental operators, Maple User Group
Previous thread: [MUG] Re: fundamental, Maple User Group
Next thread: [MUG] differental operators, Richard Patterson



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

What's New in Maple 11 for Professionals
Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055