Skip to main content

Posts

Inordered Threaded Binary Tree | Inorder and Preorder | Deletion of Node in Inordered Threaded Binary Tree

   Problem Statement:  Create an inordered threaded binary tree and perform inorder and preorder traversals. Analyze time and space complexity of the algorithm. Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class node {     int data ;     node * left , * right ;     bool isRightThreaded , isLeftThreaded ; public :     node ( int x )     {         data = x ;         left = right = NULL ;         isRightThreaded = false ;         isLeftThreaded = false ;     }     friend class TBT ; };   class TBT {     node * root , * header ; public :     TBT ()     {         root = NULL ;         header = new node ( 999 );         header -> left = header -...

Dictionary Implementation using Binary Search Tree | Adding new node | Counting Comparisons | Update Node | Delete Node | Printing Dictionary in Ascending and Descending Order

  Problem Statement:  A Dictionary stores keywords and its meanings. Provide facility for adding new keywords, deleting keywords, updating values of any entry. Provide facility to display whole data sorted in ascending/ Descending order. Also find how many maximum comparisons may require for finding any keyword. Use Binary Search Tree for implementation. Note :- Scroll horizontally to see the full line of code. #include < iostream > #include < string.h > using namespace std ; class node { public :     string keyword ;     string meaning ;     node * right ;     node * left ;     node ( string keyword , string meaning )     {         this -> keyword = keyword ;         this -> meaning = meaning ;         this -> left = NULL ;         this -> right = NULL ;     } }; class Dictionary { public...