0
//This is what we are asked to print in the assignment of Binary Search Trees.The Nodes are printed like:

 F
     +-- D
     |    +-- NULL
     |    \-- NULL
     \-- R
          +-- P
          |    +-- M
          |    |    +-- NULL
          |    |    \-- N
          |    |         +-- NULL
          |    |         \-- NULL
          |    \-- NULL
          \-- V
               +-- NULL
               \-- NULL


/*But I am not  able to print "|".
Please help.
I have printed the bst like:*/

 F
     +-- D
            +-- NULL
             \-- NULL
     \-- R
          +-- P
             +-- M
               +-- NULL
               \-- N
                       +-- NULL
                    \ -- NULL
             \-- NULL
          \-- V
               +-- NULL
               \-- NULL
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by techie929
0

Why not? Just print '|'.

#include <iostream>
using namespace std;

int main()
{
    cout << "||||||||||" << endl;
    
    return 0;
}

Edited by WaltP: n/a

0

Why not? Just print '|'.

#include <iostream>
using namespace std;

int main()
{
    cout << "||||||||||" << endl;
    
    return 0;
}

I have to print the "|" between the left node and right node of a binary search tree.

0
/*This is the assignment statement.
For BST insertion, if the input contains the following

    F
    D
    R
    P
    V
    M
    N
The resulting BST should be displayed as:
    F
     +-- D
     |    +-- NULL
     |    \-- NULL
     \-- R
          +-- P
          |    +-- M
          |    |    +-- NULL
          |    |    \-- N
          |    |         +-- NULL
          |    |         \-- NULL
          |    \-- NULL
          \-- V
               +-- NULL
               \-- NULL
*/
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.