Skip to main content

Posts

Single Circular Linked List

/* circuler link list  */ //Single Circular Linked List #include<iostream> using namespace std; class cnode { private: int data; cnode *next; public: void insert(); void add(); void search(); void update(); void delet(); void show(); }; cnode *head=NULL; cnode *tail=NULL; cnode *current=NULL; cnode *temp=NULL; int p,num; int size=0; int main() { cnode c1; string x; while(1) { cout<<"\n\n1 to insert node"<<endl; cout<<"\n2 to Add node"<<endl; cout<<"\n3 to Search in Nodes"<<endl; cout<<"\n4 to update a value"<<endl; cout<<"\n5 to delete a node"<<endl; cout<<"\n6 to display"<<endl; cout<<"\n7 to exit: "; cin>>x; if(x=="1") { c1.insert(); } else if(x=="2") { c1.add(); } else if(x=="3") { c1.search(); } else if(x=="4") { c1.update(); } else...
Recent posts

double link list

/* double link list */ #include<iostream> using namespace std; class dnode { private: dnode *prev; int data; dnode *next; public: void insert(); void add(); void search(); void update(); void delet(); void show(); }; dnode *head=NULL; dnode *tail=NULL; dnode *temp=NULL; dnode *current=NULL; int size=0; int num,p; int main() { dnode d1; string x; while(1) { cout<<"\n -------------------------------"<<endl; cout<<"\n\n=> 1 to insert node"<<endl; cout<<"\n=> 2 to Add node"<<endl; cout<<"\n=> 3 to Search in Nodes"<<endl; cout<<"\n=> 4 to update a value"<<endl; cout<<"\n=> 5 to delete a node"<<endl; cout<<"\n=> 6 to display"<<endl; cout<<"\n=> 7 to exit: "; cin>>x; cout<<"\n -------------...

stack using link list

/* stack using link list   */ #include<iostream> using namespace std; class node { private: int data; node *next; public: void push(); void pop(); void show(); }; node *head=NULL; node *tail=NULL; node *current=NULL; node *temp=NULL; int num; int size=0; int main() { node n; string x; while(1) { cout<<"\n\n1 to Push"<<endl; cout<<"\n2 to Pop"<<endl; cout<<"\n3 to Display"<<endl; cout<<"\n4 to exit: "; cin>>x; if(x=="1") { n.push(); } else if(x=="2") { n.pop(); } else if(x=="3") { n.show(); } else if(x=="4") { return 0; } else { cout<<"\nInvalid Command\n"<<endl; } } } //push Function void node::push() { cout<<"\nEnter value: "; cin>>num; temp=new node; temp->data=...

BST with deletion (binary search tree with deletion )

/* Binary tree with deleteion code any problem contact me ikkhan5757@gmail.com */ #include<iostream> #include<windows.h> #include<conio.h> using namespace std; class node; node* first=NULL; node* new_node=NULL; node* current=NULL; class node{ public: int data; node* left; node* right; int add(int num){ new_node=new node; new_node->data=num; new_node->left=NULL; new_node->right=NULL; if(first==NULL){ first=new_node; return 0; } current=first; while(1){ if( (current->data) > (new_node->data) ){ //  when child is less than parrent if( current->left == NULL){        //  if left is empty child of parent current->left=new_node; return 0; } current=current->left; } else{     if(current->right==NULL){ current->right=new_node; return 0; } current=current->right; } ...

Single Link list implementation in C++

LINK LIST PROGRAM Creating Node   #include using namespace std; class node{ private :   int data,size; node *next,*current,*head,*temp;   public:    node()    {     head=NULL;     temp=NULL;     current=NULL; next=NULL; size=0; } void insert()    {     int d;     cout<<"enter the value for the node :" cin>> d; temp=new node; temp->data=d; temp->next=NULL; size++;     if(head==NULL)     { head=temp; current=temp; } else { current->next=temp; current=current->next; }   }     void display()    { temp=head; while(temp!=NULL) {      cout< data< next; } } }; int main() { node n; n.insert();n.in...

Password in c++ (password program in c++)

/* password program in c++ #include<iostream> #include<conio.h> using namespace std; int main() {  char pss=' ';  string pass="";  cout<<"enter your password :"<<endl;  while(pss!=13)  {   pss=getch();   if(pss!=13)   {    pass+=pss;    cout<<"*";   }  } if(pass=="1234") {  cout<<" passowrd is ok "; } else {  cout<<"not accepted "; } } click to watch video