1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

from binary search tree to table representation

Discussion in 'Databases' started by zabit, May 13, 2021.

  1. #1
    How can binary search tree be printed in form of table?
    In db exist a table representation of data and other data rapresentation as binary search tree.
    If I insert some data from array 3 row * 5 column = 15 elements, I want print from binary search tree rows,columns basically cells of table.
    How can I get this goal?
     
    zabit, May 13, 2021 IP
  2. zabit

    zabit Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Nobody?
     
    zabit, May 20, 2021 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #3
    Can you give us an example of what the search tree looks like?
     
    sarahk, May 20, 2021 IP
  4. zabit

    zabit Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    In language C I have a matrix create thus:
    cell[0][0] = 0
    cell[0][1] = 1
    cell[0][2] = 2
    cell[0][3] = 3
    cell[0][4] = 4

    cell[1][0] = 0
    cell[1][1] = 1
    cell[1][2] = 2
    cell[1][3] = 3
    cell[1][4] = 4

    I insert 0 - 1 - 2 - 3 - 4 of each row in binary search tree,
    My problem is how can visit binary search tree in this order: 0 1 2 3 4 0 1 2 3 4?
    because the visit of binary search tree print node in key order.
    If I visit in pre order I get these nodes: 0 0 1 1 2 2 3 3 4 4.

    binary search tree (bst):
    https://www.cs.usfca.edu/~galles/visualization/BST.html
    https://zabicareer.000webhostapp.com/images/bst.png
     
    Last edited: May 20, 2021
    zabit, May 20, 2021 IP