-1

How to create a binary tree of value type String by C#

i don't want binary tree search i just want to make binary tree of value string to do some algorithm like BFS & DFS .. )

3
  • 1
    And what have you tried so far? Or do you want us to write the code for you? Commented May 2, 2017 at 11:34
  • i know how to create tree but buy value intger but i don't know how to do this by string Commented May 2, 2017 at 11:37
  • I guess there is no difference if the value is an int or a string ;) Give it a try... Commented May 2, 2017 at 11:43

1 Answer 1

0

You can start with a simple node class as shown below. Here Data represents a string value like you've mentioned. You can change this to int or any other type.

public class BinaryTreeNode
{
    public string Data { get; set; }
    public BinaryTreeNode Left { get; set; }
    public BinaryTreeNode Right { get; set; }

    public BinaryTreeNode(string data)
    {
        Data = data;
    }
}

Why don't you start by taking a look at some of these articles

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.