Creating a generic tree as shown in above figure
root = newNode ( 50 ) NEW_LINE ( root . child ) . append ( newNode ( 2 ) ) NEW_LINE ( root . child ) . append ( newNode ( 30 ) ) NEW_LINE ( root . child ) . append ( newNode ( 14 ) ) NEW_LINE ( root . child ) . append ( newNode ( 60 ) ) NEW_LINE ( root . child [ 0 ] . child ) . append ( newNode ( 15 ) ) NEW_LINE ( root . child [ 0 ] . child ) . append ( newNode ( 25 ) ) NEW_LINE ( root . child [ 0 ] . child [ 1 ] . child ) . append ( newNode ( 70 ) ) NEW_LINE ( root . child [ 0 ] . child [ 1 ] . child ) . append ( newNode ( 100 ) ) NEW_LINE ( root . child [ 1 ] . child ) . append ( newNode ( 6 ) ) NEW_LINE ( root . child [ 1 ] . child ) . append ( newNode ( 1 ) ) NEW_LINE ( root . child [ 2 ] . child ) . append ( newNode ( 7 ) ) NEW_LINE ( root . child [ 2 ] . child [ 0 ] . child ) . append ( newNode ( 17 ) ) NEW_LINE ( root . child [ 2 ] . child [ 0 ] . child ) . append ( newNode ( 99 ) ) NEW_LINE ( root . child [ 2 ] . child [ 0 ] . child ) . append ( newNode ( 27 ) ) NEW_LINE ( root . child [ 3 ] . child ) . append ( newNode ( 16 ) ) NEW_LINE