Results 1 to 5 of 5

Thread: Binary Tree Code

  1. #1

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    In C++ you'd do something like:

    Code:
    struct Node
    {
        int data;
        Node *right;
        Node *left;
    }
    I think. Ported to VB, you could do this (without pointers, thank god):

    VB Code:
    1. Type TreeNode
    2.     DataAtNode As Variant
    3.     Dim RightN As Node
    4.     Dim LeftN As Node
    5. End Type

    But I hate data structures, especially involving pointers, so does anyone else have an opinion?

  2. #2
    Fanatic Member
    Join Date
    Sep 2000
    Location
    UK.
    Posts
    728

    Smile Info.

    You can't Dim variables inside type blocks. So flburt1's code would become:

    VB Code:
    1. Type TreeNode
    2.     DataAtNode As Variant
    3.     RightN As Node
    4.     LeftN As Node
    5. End Type

    Laterz
    Digital-X-Treme
    Contact me on MSN Messenger: [email protected]

    [VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
    / (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]

  3. #3
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    If you are trying to program a tree, here I have a suggestion...

    Binary Tree Thread
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    uhhh.. the guy doesn't even visit the boards anymore, and this is more than a year old...
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Talking Ooops...

    I did not know that.. Sorry Buggy... I just searched for all who had problems with trees and see which I could help.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width