Solved

Binary Trees in Pascal

Posted on 1998-10-22
18
627 Views
Last Modified: 2011-10-03
Can someone write a binary tree program in Pascal so that I don't have to please?  It has to be impressive so it makes me look good.
0
Comment
Question by:BIGAL
  • 8
  • 3
  • 2
  • +5
18 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1215813
Talk about honesty!  This site isn't for people to HOMEWORK for others.  You should try to do this yourself and then ask for help on the parts you are having problems with.  

Otherwise, find someone local to you who you can pay.  
0
 
LVL 2

Expert Comment

by:gikam
ID: 1215814
kelly's right
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1215815
its easy , try it.

0
 
LVL 4

Accepted Solution

by:
jack_p50 earned 100 total points
ID: 1215816
Give me your e-mail, and i send it to you - i have a couple of this.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215817
In order to grasp the concept of binary trees, you have to do it yourself.  It is one of the most complex data structures.
0
 
LVL 7

Expert Comment

by:Motaz
ID: 1215818
The most interesting thing in programming is to solv your porblems by your self.

Data structure is the most interesting field in computer science specially when we understand it.

Motaz from Sudan.
0
 
LVL 3

Expert Comment

by:daitt
ID: 1215819
Just accept jack_p50's answer and get source code. No matter what all others tell you, if you just need programs for your work (you have no time, not interesting in data structure but have to work with it, I suppose). But if you want to understand algorithms, you have to do it yourself, without or with a little help from others.
Anyway, I have tell you that I'm totally sad here.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215820
Daitt: it is clearly homework.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1215821
Hey, what's a binary tree and what it is needed for??

Vik
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:scrapdog
ID: 1215822
It is a data structure like a linked list, except each node has two links.  There are many uses for binary trees...3-d games use them, mathematical parsers uses them...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1215823
Ya, Kevin....Can you show me a simple example.... If you decide to give me an example, you could do it by mail ;-)

Cheers,
Viktor
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215824
Here is a very simple way of coding a binary tree:

type
  PNode = ^TNode;
  TNode = record
            Value :Integer;
            Left  :PNode;
            Right :PNode;      
          end;

var a,b,c,d,e,f,g,h :PNode;
begin
  New(b);
  New(c);
  New(a);
  a^.Left := b;
  a^.Right := c;
  New(d);
  New(e);
  d^.Left := a;
  d^.Right := e;
  New(f);
  e^.Left := f;
  New(g);
  b^.Left := g;
  New(h);
  c^.Right := h;
  ...
  ...
end.

This would create a tree that looks like this:
________________D
_______________/_\  
______________/___\
_____________A_____E
____________/_\___/
___________B___C_F
__________/_____\
_________G_______H

I used the underscores to make sure everything lines up OK.        

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215825
Vik:   that still looks screwed up, even though I used underscores.  Copy and paste that into the "Have a comment to..." box to look at it in the Courier font.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1215826
I just pasted it in Notepad, and it looks very pretty ;-)

I've seen this kinda stuff somewhere... Is that how databases are done??? Kinda???

btw- Thanks for the example :-)

Vik
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215827
Databases don't *normally* use trees, but they could.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215828
Here's somewhat of a tutorial on binary trees:

http://www.geocities.com/SiliconValley/Way/8593/javadata.html

It's in java however.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1215829
0
 
LVL 4

Expert Comment

by:jack_p50
ID: 1215830
Trees can be used for expression evaluators
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to delete from listbox using edit box 6 292
VB.Net code to pascal 1 391
Delphi Ascii code 2 970
How to Call Delphi DLL Method from C++  with Var WideString parameter 4 2,545
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now