Python programming is much easier compared to C language. We really do not need to take care of memory management. It is quite simplified. If you know how memory management is done in Python, please share info.
Today I tried to write a program to construct the binary tree and check if the constructed binary tree is BST in non-recursive way.
Following code uses defines two main classes for Queue and Binary Tree :
· Queue class defines two routines for Enqueue and Dequeue.
· Tree class defines two routines insert and isBST.
Class to create a tree node:
Class to create a queue entry:
Class to create Queue:
Function to check if BT is BST :
Code to test :