//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

Why not? Just print '|'.

#include <iostream>
using namespace std;

int main()
{
    cout << "||||||||||" << endl;
    
    return 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.

/*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
*/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.