Inserting a structured file into a binary tree

Home Forums C Programming Inserting a structured file into a binary tree

This topic contains 0 replies, has 1 voice, and was last updated by  Alam 9 years, 8 months ago.

  • Author
    Posts
  • #2092

    Alam
    Participant

    Heya, I’m having a spot of trouble trying to place a structured file into a binary tree. I’ll try to explain what I’m trying to accomplish as best as I can.

    I have a file, containing a binary tree structure that looks like this:

    example:

    after inserting into a tree should look like this:

    Basically, the ordered pairs are what I put into the tree, ordered by the first coordinate, and [] means an empty tree.

    The problem is that I can sorta form an algorithm in my head, but I don’t know how to go about coding this. So far, I’ve tried putting the structure into a character array and going one by one to search for the numbers, however I don’t know how to set it up so that I can recursively build my tree.

    Can anyone help me?

    Thank you for your time.

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble