C# binary tree - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C# binary tree

guy selaguy sela Posts: 2Member
Hi
i'm new to c# and would like to know how do i write a simple app
that will sort using binary tree a list with first & last name.
When i add a new name it will sort them
thanx
guy

Comments

  • STiATSTiAT Posts: 4Member
    [b][red]This message was edited by the STiAT at 2002-6-18 9:3:4[/red][/b][hr]
    [b][red]This message was edited by the STiAT at 2002-6-18 8:56:44[/red][/b][hr]
    : Hi
    : i'm new to c# and would like to know how do i write a simple app
    : that will sort using binary tree a list with first & last name.
    : When i add a new name it will sort them
    : thanx
    : guy
    :

    Use classes like in C++. It's simple, you have a class for the tree, and one for the list of elements of the tree, and one for the elements of the list

    class list_element
    {
    private string fname, lname;
    private list_element next, back;

    //public ...

    }

    class tree_element
    {
    private list_element head;
    private tree_element left, right;
    //public ...
    }

    class btree
    {
    private tree_element root;
    //public all access functions...
    }




  • guy selaguy sela Posts: 2Member
    : [b][red]This message was edited by the STiAT at 2002-6-18 9:3:4[/red][/b][hr]
    : [b][red]This message was edited by the STiAT at 2002-6-18 8:56:44[/red][/b][hr]
    : : Hi
    : : i'm new to c# and would like to know how do i write a simple app
    : : that will sort using binary tree a list with first & last name.
    : : When i add a new name it will sort them
    : : thanx
    : : guy
    : :
    :
    : Use classes like in C++. It's simple, you have a class for the tree, and one for the list of elements of the tree, and one for the elements of the list
    :
    : class list_element
    : {
    : private string fname, lname;
    : private list_element next, back;
    :
    : //public ...
    :
    : }
    :
    : class tree_element
    : {
    : private list_element head;
    : private tree_element left, right;
    : //public ...
    : }
    :
    : class btree
    : {
    : private tree_element root;
    : //public all access functions...
    : }
    :
    :
    :
    :
    :

Sign In or Register to comment.