text: To add a new node
code: static Node newNode ( int k ) { Node node = new Node ( ) ; node . data = k ; node . right = node . left = null ; return node ; } static bool isHeap ( Node root ) { Queue < Node > q = new Queue < Node > ( ) ; q . Enqueue ( root ) ; bool nullish = false ; while ( q . Count != 0 ) { Node temp = q . Peek ( ) ; q . Dequeue ( ) ; if ( temp . left != null ) { if ( nullish temp . left . data >= temp . data ) { return false ; } q . Enqueue ( temp . left ) ; } else { nullish = true ; } if ( temp . right != null ) { if ( nullish temp . right . data >= temp . data ) { return false ; } q . Enqueue ( temp . right ) ; } else { nullish = true ; } } return true ; }