0

So let's say that I have an array, and it contains 10 elements. I want to set the first element as the root, and then if the next number is smaller, put it to the left, if larger to the right. How would I do this?

2
  • 2
    There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. Commented Jan 15, 2016 at 16:33
  • To the left, or right of what exactly? Commented Jan 15, 2016 at 16:35

1 Answer 1

1

Actually, I have figured it out now. I can just set another type called tree and it has itself, leftbranch and rightbranch, and leftbranch and rightbranch are also trees.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.