'' Count is used to diffentiate  each level of the tree
count = 1 NEW_LINE min_v = INT_MAX NEW_LINE while ( qt ) : NEW_LINE INDENT temp = qt . popleft ( ) NEW_LINE min_v = min ( min_v , temp . key ) NEW_LINE if ( temp . left ) : NEW_LINE INDENT qt . append ( temp . left ) NEW_LINE DEDENT if ( temp . right ) : NEW_LINE INDENT qt . append ( temp . right ) NEW_LINE DEDENT count -= 1 NEW_LINE if ( count == 0 ) : NEW_LINE INDENT levelMin . append ( min_v ) NEW_LINE min_v = INT_MAX NEW_LINE count = len ( qt ) NEW_LINE DEDENT DEDENT