Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help needed regarding binary trees
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
A.J




PostPosted: Mon Feb 04, 2008 1:41 pm   Post subject: Help needed regarding binary trees

I needed to know how to initialize a binary tree on turing.
This is what i know so far
code:

var tree :collection of
record
name:string
left,right:pointer to tree
end record

but i do not know how to initialize the tree (like for example set 'A' as the root then set 'B' and 'C' as the children of 'A' and so on...)
so if anyone could help me , that will be great.
I also attached a program (and the file it reads from) making a binary heap stored on an array (see http://en.wikipedia.org/wiki/Binary_heap for more detail on what I have done) but it creates the heap for a list of 100000 numbers (on the text file) in approx. 5 seconds. Is there a faster method?



a.txt
 Description:

Download
 Filename:  a.txt
 Filesize:  770.3 KB
 Downloaded:  897 Time(s)


Heap.T
 Description:

Download
 Filename:  Heap.T
 Filesize:  1.69 KB
 Downloaded:  57 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: