Insert 100 in all Leaf nodes and 10 in all non leaf nodes using BST

Insert 100 in all Leaf nodes and 10 in all non leaf nodes using BST in C++ #include#includeclass Node{private: int data; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } Node *p,*q; p=q=root; while (q!=NULL){ p=q; ifContinue reading “Insert 100 in all Leaf nodes and 10 in all non leaf nodes using BST”

Take Maximum Node Make it Root Node

Take Maximum Node Make it Root Node and attach rest of tree with it so that BST Property will not volatilized #include#includeclass Node{private: int data,i; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; Node* remove(Node *root, int value){ Node *t; int cmpr = value – root->data; if (cmpr < 0){ t = remove(root->left, value); root->leftContinue reading “Take Maximum Node Make it Root Node”

Find Minimum node make it Root node attach rest of Tree with it such that BST property is not violated

Find Minimum node make it Root node attach rest of Tree with it such that BST property is not violated #include#includeclass Node{private: int data,i; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root;Node* remove(Node *root, int value){ Node *t; int cmpr = value – root->data; if (cmpr < 0){ t = remove(root->left, value); root->left = t;Continue reading “Find Minimum node make it Root node attach rest of Tree with it such that BST property is not violated”

Traverse Tree According To User Value :Get Value From User ☻ :~C++ Code Tree

Traverse Tree According To User Value :Get Value From User ☻#include#includeclass Node{private: int data; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } Node *p,*q; p=q=root; while (q!=NULL){ p=q; if (newnode->data> q->data) q = q->right; else qContinue reading “Traverse Tree According To User Value :Get Value From User ☻ :~C++ Code Tree”

Traverse Left Subtree with Post Order and Right Sub tree with PreOrder ~ C++ Codes Tree

Traverse root left sub tree with post order ☻and then print root ☻and then root right sub tree with pre order ☻ #include#includeclass Node{private: int data; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } Node *p,*q;Continue reading “Traverse Left Subtree with Post Order and Right Sub tree with PreOrder ~ C++ Codes Tree”

Insert A Value on Left Side which is greater Then Root and Small Value on Right side ~ C++ Tree codes

Insert A Value on Left Side which is greater Then Root and Small Value on Right side #include #include class Node{ private: int data; Node* right,*q,*p; Node* left; public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } Node *p,*q; p=q=root;Continue reading “Insert A Value on Left Side which is greater Then Root and Small Value on Right side ~ C++ Tree codes”

Convert Left subtree into right subtree and right into left in tree C++ code: ~ BST

Convert Left Sub Tree of a Root into Right Sub Tree and Right sub Tree into Left Sub Tree ☺ ☻#include#includeclass Node{private: int data; Node* right,*q,*p; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } Node *p,*q; p=q=root; while (q!=NULL){Continue reading “Convert Left subtree into right subtree and right into left in tree C++ code: ~ BST”

BST (Binary Search Tree) in C++

Creation of BST(binary Search Tree),Insertion at any point,Deletion At any point,Maximum Value,Minimum Value,Searching in tree [[Important Data Structure Codes in C++]]Tree Non Liner Data Structure#include#includeclass Node{private: int data; Node* right; Node* left;public: Node(){ root=NULL; right=left=NULL; }Node *root; void insert(int data){ Node* newnode = new Node(); newnode->data = data; if (root == NULL){ root=newnode; return; } NodeContinue reading “BST (Binary Search Tree) in C++”

Calculator using Java script and HTML /CSS

Calculator form{background-color:#E0FFE0; text-align:center; width:300px; height:409px;margin:0 auto; border:2px solid yellow; } form input{background-color:#FFCCCC; width:60px; height:60px; margin:5px 5px; font-size:14pt; border-radius:50px;} Welcome Calculator by JavaScript By. Usman Siddique var firstNum; var secondNum; var total; var plusminus; var plusClick; var minusClick; var multiplyClick; var devideClick; var decimalClick; function Clear() { // Clear document.f.result.value=””; document.f.display.value=””; } function num0Perform() { //Continue reading “Calculator using Java script and HTML /CSS”