Skip to main content

Binary Search Tree in C++( dynamic memory based )

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include<bits/stdc++.h>
using namespace std;
struct bst
{
    int val;
    bst *left,*right;

};
bst *root=nullptr;
void srch(int num,bst * head)
{if (head==nullptr){
cout<<"\nNumber is not present\a"<<endl;
return;
}
if (head->val==num)
{
    cout<<"\nNumber is present\n\a";
    return;
}

else
{

    if(num<head->val) srch(num,head->left);
    else srch(num,head->right);
}


}
void insrt(int num)
{
     bst *node=new bst;
    node->val=num;
    node->left=node->right=nullptr;
if(root==nullptr)
{

    root=node;

}else
{bst * temp=root;
while(temp!=nullptr)
{
    if(num<=temp->val)
    {// to the left

        if (temp->left!=nullptr)
            temp=temp->left;

         else   {temp->left=node;
         return;
         }


    }else
    {// goto r1111ight
        if(temp->right!=nullptr)
        {

            temp=temp->right;
        }else
        {
           temp->right=node;
           return;

        }

    }



}


}

}
void display(bst * head)
{if(head==nullptr)
return;
display(head->left);
cout<<" "<<head->val<<" ";
display(head->right);


}
int main()
{
char ch;
   do
    {
    cout<<"\nPress\n1 To insert\n2. to display \n 3. to search\nq to exit--->";
    ch=getchar();
    if(ch=='1')
    {int i;
    cout<<"\nenter number to insert-->";
    cin>>i;
        insrt(i);
       cout<<"\n_________________________\n\tdisplay\n_________________________\n\n";
        display(root);
        cout<<"\n_________________________\n\n";
    }

    if (ch=='2')


    {cout<<"\n_________________________\n\tdisplay\n_________________________\n\n";
        display(root);
        cout<<"\n_________________________\n\n";

    }

    if(ch=='3')
    {
        int i;
        cout<<"\nNUMBER TO SEARCH-->";
        cin>>i;
        srch(i,root);

    }fflush(stdin);
    cout<<" \npress Enter key to continue\n";

    getchar();
    }while
    (ch!='q');


}

Comments

  1. Your Affiliate Money Printing Machine is ready -

    And getting it running is as easy as 1---2---3!

    This is how it all works...

    STEP 1. Choose which affiliate products you want to promote
    STEP 2. Add some PUSH BUTTON TRAFFIC (it LITERALLY takes JUST 2 minutes)
    STEP 3. See how the affiliate system explode your list and sell your affiliate products all on it's own!

    Are you ready to make money ONLINE??

    Click here to check it out

    ReplyDelete
  2. Easy "water hack" burns 2 lbs OVERNIGHT

    More than 160,000 men and women are hacking their diet with a simple and secret "liquid hack" to lose 2lbs each and every night in their sleep.

    It's scientific and it works on anybody.

    Just follow these easy step:

    1) Get a clear glass and fill it up with water half glass

    2) And now use this crazy hack

    you'll be 2lbs thinner as soon as tomorrow!

    ReplyDelete
  3. Did you realize there's a 12 word phrase you can communicate to your man... that will induce intense emotions of love and impulsive attractiveness to you buried within his chest?

    Because deep inside these 12 words is a "secret signal" that triggers a man's instinct to love, adore and protect you with his entire heart...

    ===> 12 Words Who Fuel A Man's Love Response

    This instinct is so hardwired into a man's mind that it will drive him to try harder than ever before to make your relationship the best part of both of your lives.

    As a matter of fact, triggering this dominant instinct is absolutely mandatory to achieving the best ever relationship with your man that the moment you send your man one of the "Secret Signals"...

    ...You will immediately find him open his mind and heart to you in a way he's never experienced before and he'll perceive you as the only woman in the world who has ever truly attracted him.

    ReplyDelete
  4. Your Affiliate Profit Machine is waiting -

    And getting it set up is as simple as 1-2-3!

    It's super easy how it works...

    STEP 1. Input into the system which affiliate products the system will advertise
    STEP 2. Add some PUSH button traffic (it takes JUST 2 minutes)
    STEP 3. See how the system explode your list and sell your affiliate products on it's own!

    Are you ready to make money ONLINE???

    Get the full details here

    ReplyDelete
  5. If you're looking to lose weight then you have to get on this brand new custom keto meal plan.

    To create this keto diet service, licensed nutritionists, personal trainers, and chefs united to develop keto meal plans that are efficient, suitable, price-efficient, and fun.

    From their grand opening in January 2019, 100's of individuals have already completely transformed their body and health with the benefits a good keto meal plan can offer.

    Speaking of benefits; in this link, you'll discover 8 scientifically-proven ones offered by the keto meal plan.

    ReplyDelete
  6. Your Affiliate Profit Machine is waiting -

    Plus, getting it set up is as easy as 1...2...3!

    Here are the steps to make it work...

    STEP 1. Tell the system what affiliate products you want to promote
    STEP 2. Add some PUSH BUTTON TRAFFIC (it ONLY takes 2 minutes)
    STEP 3. See how the system explode your list and sell your affiliate products all by itself!

    So, do you want to start making money???

    Your MONEY MAKING affiliate solution is RIGHT HERE

    ReplyDelete

Post a Comment

share your thoughts ....

Popular posts from this blog

download Code blocks 13.12 mingw.setup .exe 97 mb

NOTE: A newer version is been updated on the site ... visit here  http://vastgk.blogspot.com/2017/07/download-code-blocks-1601-mingwsetup.html File Date Download from codeblocks-13.12-setup.exe 27 Dec 2013 BerliOS  or  Sourceforge.net codeblocks-13.12mingw-setup.exe 27 Dec 2013 BerliOS  or  Sourceforge.net codeblocks-13.12mingw-setup-TDM-GCC-481.exe 27 Dec 2013 BerliOS  or  Sourceforge.net NOTE : The codeblocks-13.12mingw-setup.exe file  includes  the GCC compiler and GDB debugger from  TDM-GCC  (version 4.7.1, 32 bit). The codeblocks-13.12mingw-setup-TDM-GCC-481.exe file includes the TDM-GCC compiler, version 4.8.1, 32 bit. While v4.7.1 is rock-solid (we use it to compile C::B), v4.8.1 is provided for convenience, there are some known bugs with this version related to the compilation of Code::Blocks itself. IF UNSURE, USE "codeblocks-13.12mingw-setup.exe"!  \ Linux 32-bit: Dis...

Supported OS id and their code in an installer

Hello frnd this is the code and thier Operating system id in windows ,to identify which program run in which windows The ID below indicates application support for Windows Vista -->           --The ID below indicates application support for Windows 7 -->           -The ID below indicates application support for Windows 8 -       supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" code provided to you by Rajlive360.tk

Creating an Executable Jar File

Creating a jar File in  Eclipse In  Eclipse  Help contents, expand "Java development user guide" ==> "Tasks" ==> "Creating JAR files."  Follow the instructions for "Creating a new JAR file" or "Creating a new runnable JAR file."The  JAR File  and  Runnable JAR File  commands are for some reason located under the  File menu: click on  Export...  and expand the  Java  node. Creating a jar File in  JCreator You can configure a "tool" that will automate the jar creation process.  You only need to do it once. Click on  Configure/Options . Click on  Tools  in the left column. Click  New , and choose  Create Jar file . Click on the newly created entry  Create Jar File  in the left column under  Tools . Edit the middle line labeled  Arguments:  it should have cvfm $[PrjName].jar manifest.txt *.class Click OK. Now set...

How to Bypass Right Click Block on Any Website

In order to block the right-click activity, most websites make use of JavaScript which is one of the popular scripting languages used to enhance functionality, improve user experience and provide rich interactive features. In addition to this, it can also be used to strengthen the website’s security by adding some of the simple security features such as  disabling right-click ,  protecting images ,  hiding or masking parts of a web page  and so on. How JavaScript Works? Before you proceed to the next part which tells you how to disable the JavaScript functionality and bypass any of the restrictions imposed by it, it would be worthwhile for you to take up a minute to understand how JavaScript works. JavaScript is a client side scripting language (in most cases), which means when loaded it runs from your own web browser. Most modern browsers including IE, Firefox, Chrome and others support JavaScript so that they can interpret the code and carry out action...

Java Program to find whether a given string is palindrome or not

import javax.swing.*; class palindrome{     public static void main(String args[]){         String wd;         int i, len;         boolean ispal;         wd = JOptionPane.showInputDialog("Enter a Word:");         len = wd.length();                 i=0;         ispal=true;         for(;i<=len;){             if(wd.charAt(i) == wd.charAt(len-1)){                 i++;                 len--;                 }             else{                 ispal = false;                 break;             } ...

DOWNLOAD CODE BLOCKS 16.01 MINGW.SETUP .EXE 86.3 MB

Code::Blocks for Mac is a free C, C++ and Fortran IDE that has a custom build system and optional Make support. The application has been designed to be very extensible and fully configurable. Code::Blocks is an IDE packed full of all the features you will need. It has a consistent look, feel and operation across its supported platforms. It has been built around a plugin framework, therefore Code::Blocks can be extended with plugins. Support for any kind of functionality can be added by installing/coding a plugin. Key features include: Written in C++. No interpreted languages or proprietary libs needed.. Full plugin support. Multiple compiler support: GCC (MingW / GNU GCC), MSVC++, clang, Digital Mars, Borland C++ 5.5, and Open Watcom etc. Support for parallel builds. Imports Dev-C++ projects. Debugger with full breakpoints support. Cross-platform. Code::Blocks' interface is both customizable and extensible with Syntax highlighting, a tabbed interface, Class Br...

How to install gta sanandreas mods

INdex 1.GTA San Andreas System Requirements 2.Backing Up 3.Installing The Mod --Method 1: Using IMG Tool --Method 2 Self Mod Installers ----GMM ----San Andreas Mod Installer --Installing cloths --Installing Weapons 4.Tips 5.My Mods arn't working! Starting off 1.GTA San Andreas System Requirements You need to make sure you computer can run San Andrease. Theese are the Requirements. Recommended System Requirements: Intel Pentuim 4 or AMD XP Processor (or better) 384MB RAM 16x Speed DVD Drive 4.7GB Hard Drive Space 128MB Video Card DirectX 9 compatible sound & video drivers Keyboard, mouse or game pad Minimum System Requirements: 1GHz Pentuim III or AMD Athlon 256MB RAM 8x Speed DVD Drive 3.6 GB Hard Disk Space 64MB Video Card DirectX 9 compatable sound & video drivers Keyboard, mouse 2.Backing Up Before you do anything to the game, back up the files you are going to mod. I usally copy the GTA folder and rename it "Normal San And...

Windows 10 English x64.iso 4.03 GB download direct (google drive) creator update 1703 ..latest windows 10

updated ON 1/01/2018 Windows 10 English x64.iso 4.03 GB download direct (google drive) creator update 1703 ..latest windows 10 x64  .. NEW LINK latest version fall creator 1709 update : click here Updated : 5 july 3 PM (IST) Link to the file  click here link: https://www.multcloud.com/share/7977c732-8fa3-4cb7-ae58-a6d99d66bb5b   Just goto to the following link and enter your email address and get the password delivered to you.. Password to the link is :  HERE (FOR PASSWORD OF ABOVE LINK)  OR USE THE FORM BELOW.... Loading... size : 4.03 GB  Language : ENGLISH INTERNATIONAL SYSTEM :WINDOWS 10 x64 BASED.. TYPE : DIRECT DOWNLOAD LINK ......ISO FILE> TORRENT  windows 10 creator update 1703/ 1709 iso FOR OTHER mirror 2 link goto here and enter your email address you will get a email with link to the file....