Hey guys,

I have been working on my display function to print out the heaps in binary tree version. I'm trying to get this:
         1492
         1783 1776
         1804 1865 1945 1963
         1918 2001 1941

to (something similar to this)

                _____ 1492____
               /                           \
           1783                      1776
          /        \                     /       \
     1804   1865           1945    1963
     /    \            /    
1918  2001  1941

The first function for the 1st display showed is:



void displayQueue( int q[], int size)
{
    for( int i=1; i<size; i++)
{
        // Display newline between levels if current value // is power of 2
        //    logb gives floating point log, and log2 is
// integer log value.
        if( logb(i) == log2(i)) {
            cout << endl;
        }
        cout << q << " ";
    }
    cout << endl;   // make sure output buffer is flushed
}


I'm have been trying to change this function to display the version of binary tree without '\' or '/'. Since parent would be the top of left child and right child, I assume it would work this way. It would print out only the left side numbers like this.

1492
1783
1804
1918


Any tips would be great appreciated! (the function below is something I have been trying to fix!)

void displayQueue(int q[], int size)
{
    for(int i = 1; i < size; i++)
    {
        // Display newline between levels if current value // is power of 2
        //    logb gives floating point log, and log2 is
// integer log value.
        if(logb(i) == log2(i))
        {
            if(parent)
            {
                cout << "   " << q << "   " << endl;
            }
            else if(leftChild)
            {
                cout << q << "      ";
            }
            else if(rightChild)
            {
                cout << q << endl;
            }
        }
        //cout << q << " ";
    }
    cout << endl;   // make sure output buffer is flushed
}