SlideShare ist ein Scribd-Unternehmen logo
1 von 34
IMPLEMENTATION OF QUEUE USING LINKED LIST

#include<iostream.h>
#include<process.h>
#include<conio.h>
class equeue
{
 struct node
 {
  int info;
  node *next;
 }*front,*rear;
public:equeue()
{
 front=rear=NULL;
}
 void insert(void);
 void deleted(void);
 void display(void);
};

void equeue::insert()
{
 node *temp=new node;
 cout<<"n Enter Value To Insert:";
 cin>>temp->info;
 temp->next=NULL;
 if(front==NULL)
 {
  front=rear=temp;
 }
 else
 {
  rear->next=temp;
  rear=rear->next;
 }
}

void equeue::deleted()
{
 if(front==NULL)
 {
  cout<<"n Queue Is Emptyn";
 }
 else
{
  if(front==rear)
  {
   cout<<"n Deleted Element Is :"<<front->info;
   front=rear=NULL;
  }
  else
  {
    node *temp=front;
    cout<<"n Deleted Element Is :"<<temp->info;
    front=front->next;
    delete(temp);
  }
 }
}

void equeue::display()
{
  if(front==NULL)
   cout<<"Queue Is Emptyn";
  else
  {
   node *t=front;
   while(t->next!=NULL)
   {
     cout<<t->info<<"n";
     t=t->next;
   }
   cout<<t->info;
 }
}

void main()
{
 equeue c;
 int ch;
 clrscr();
 while(1)
 {
  cout<<"n 1.Insertn 2.Deleten 3.Displayn 4.Exitn";
  cout<<"n Enter Your Choice:";
  cin>>ch;
  switch(ch)
  {
   case 1:c.insert();
break;
   case 2:c.deleted();
   break;
   case 3:c.display();
   break;
   case 4:exit(0);
   break;
   default:cout<<"n Enter The Right Choice";
  }
 }
}




OUTPUT:

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice: 1
Enter the value to insert: 11

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice: 1
Enter the value to insert:22

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice: 1
Enter the value to insert:33

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice: 3
11 22 33
1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice:2
Deleted Element is: 11

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice:2
Deleted Element is: 22

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice:2
Deleted Element is: 33

1.Insert
2.Delete
3.Display
4.Exit
Enter Your Choice:3
Queue is Empty
IMPLEMENTATION OF DOUBLE LINKED LIST

#include <iostream.h>
#include<MEMMGR.H>
#include<process.h>
#include<conio.h>
class dllist
{
 struct node
 {
 int value;
 struct node *next;
 struct node *prev;
 };
 struct node *start;
 public: dllist()
 {
  start=NULL;
  }
  void insertbegin(int value);
  void insertend(int value);
  void insertmiddle(int value,int nvalue);
  void deletebegin();
  void deleteend();
  void deletemiddle(int value);
  void display();
  };

void dllist::insertmiddle(int value,int nvalue)
         {
                 struct node *temp,*curr,*ncurr;
                 temp=(struct node*)new (struct node);
                 temp->value=value;
                 curr=start;
                 while(curr->value!=nvalue)
                 {
                  curr=curr->next;
                 }
              temp->prev=curr;
              temp->next=curr->next;
              curr->next=temp;
        }
void dllist::insertbegin(int value)
         {
                 struct node *temp;
                 temp=(struct node*)new (struct node);
                 temp->value=value;
                 if(start==NULL)
                 {
                          temp->prev=NULL;
                          temp->next=NULL;
                          start=temp;
                 }
                 else
                 {
                          temp->next=start;
                          temp->prev=NULL;
                          start=temp;

               }
        }

void dllist::insertend(int value)
        {
                 struct node *temp,*curr;
                 temp=(struct node *)new(struct node);
                 temp->value=value;
                 curr=start;
                 while(curr->next!=NULL)
                 {
                 curr=curr->next;
                 }
                 temp->prev=curr;
                 curr->next=temp;
                 temp->next=NULL;
        }

void dllist::deletebegin()
         {
           struct node *curr;
           curr=start;
           start=curr->next;
           start->prev=NULL;
           cout<<curr->value;
           free(curr);
         }
void dllist::deleteend()
{
        struct node *curr=start,*pcurr;
        while(curr->next!=NULL)
         {
         pcurr=curr;
         curr=curr->next;
         }
         pcurr->next=NULL;
         cout<<curr->value;
         free(curr);
}

void dllist::deletemiddle(int value)
{

       struct node *curr=start,*pcurr,*ncurr;
       pcurr=ncurr=start;
       while(curr->value!=value)
       {
       pcurr=curr;
       curr=curr->next;
       }
       ncurr=curr->next;
       pcurr->next=curr->next;
       ncurr->prev=curr->prev;
       cout<<"deleted element:"<<curr->value;
       free(curr);
}

void dllist::display()
{
        struct node *curr;
        curr=start;
        cout<<"nThe list is :n";
        if(curr==NULL)
         cout<<"list is empty";
         else
         {
         while(curr->next!=NULL)
                 {
                  cout<<curr->value<<"->";
                  curr=curr->next;
                 }
                 cout<<curr->value;
         }
}

void main()
{
int ch1,ch2,num,nd;
dllist st;
clrscr();
while(1)
{
 cout<<"n1.Insertn2.Deleten3.Displayn4.Exitn";
cin>>ch1;
switch(ch1)
{
 case 1:
     {
      cout<<"nInsert :n1.Beginningn2.Endn3.Middlen";
           cin>>ch2;
           switch(ch2)
           {
            case 1:
                  {
                   cout<<"enter the element:";
                   cin>>num;
                   st.insertbegin(num);
                   break;
                  }
            case 2:
                  {
                   cout<<"enter the element:";
                   cin>>num;
                   st.insertend(num);
                   break;
                  }
            case 3:
                  {
                   cout<<"enter the node after which to insert:";
                   cin>>nd;
                   cout<<"enter the element:";
                   cin>>num;
                   st.insertmiddle(num,nd);
                   break;
                  }
           default: cout<<"enter the correct choice";
         }
    break;
}
case 2:
    {
     cout<<"nDelete:n1.Beginningn2.Endn3.Middle";
         cin>>ch2;
         switch(ch2)
         {
          case 1:
                 {
                  cout<<"Deletion fron beginning:";
                  st.deletebegin();
                  break;
                 }
          case 2:
                 {
                  cout<<"Deletion from the end:";
                  st.deleteend();
                  break;
                 }
          case 3:
                 {
                  cout<<"enter the node to be deleted:";
                  cin>>nd;
                  st.deletemiddle(nd);
                  break;
                 }
         default: cout<<"enter the correct choice";
        }
        break;
    }
case 3:
    {
         st.display();
         break;

   }
case 4:exit(0);
default: cout<<"enter the correct choice";
}

}
}
OUTPUT:
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice: 1

Insert:
1.Beginning
2.End
3.Middle
1
Enter the element:11

1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:1

Insert:
1.Beginning
2.End
3.Middle
2
Enter the element:22

1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:1

Insert:
1.Beginning
2.End
3.Middle
3
Enter the node after which to insert:11
Enter the element:33

1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:3
11->33->22

1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:2

Delete:
1.Beginning
2.End
3.Middle
3
Enter the node to be deleted: 33
Deleted element :33

1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:2

Delete:
1.Beginning
2.End
3.Middle
1
Deletion from the beginning 11

 1.Insert
2.Delete
3.Display
4.Exit
Enter your choice:2

Delete:
1.Beginning
2.End
3.Middle
2
Deletion from the end 22
IMPLEMNTATION OF BINARY SEARCH TREE NON RECURSIVE
                           TRAVERSAL
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<malloc.h>
#include<process.h>

struct bstree
{
        int data;
        struct bstree*left;
        struct bstree*right;
}*root=NULL;

class bst
  {
    private:

   public :
      void insert(bstree *,int);
      void inorder_non_rec(bstree*);
      void preorder_non_rec(bstree*);
      void postorder_non_rec(bstree*);
      };

class stack
 {
   int top;
   bstree *stackel[20];
   public:
     stack()
          {
            top=-1;
          }
        void push(bstree *);
        bstree* pop();
        int empty()
        {
          if(top==-1)
             return(1);
          else
          return(0);
        }
 };
class stack_int
 {
   int top;
   int stack_int[20];
   public:
    stack_int()
          {
            top=-1;
          }
    void push(int flag);
    int pop();
    int empty_int()
         {
           if(top==-1)
             return(1);
           else
             return(0);
         }
   };

void stack_int::push(int flag)
   {
     stack_int[++top]=flag;
   }
int stack_int::pop()
   {
     return(stack_int[top--]);
   }

void stack::push(bstree *node)
 {
   stackel[++top]=node;
 }

bstree *stack::pop()
 {
   return(stackel[top--]);
 }

void bst :: insert(struct bstree*head,int val)
{
       struct bstree *temp1,*temp2;
       if(head == NULL)
       {
head=(struct bstree*)malloc(sizeof(struct bstree));
              root=head;
              head->data=val;
              head->left=NULL;
              head->right=NULL;
       }
       else
       {
               temp1=head;
               while(temp1 != NULL)
               {
                      temp2=temp1;
                      if(temp1->data > val)
                             temp1=temp1->left;
                      else
                             temp1=temp1->right;
               }
              if(temp2->data > val)
              {
                      temp2->left=(struct bstree*)malloc(sizeof(struct bstree));
                      temp2=temp2->left;
                      temp2->data=val;
                      temp2->left=NULL;
                      temp2->right=NULL;
              }
              else
              {
                      temp2->right=(struct bstree*)malloc(sizeof(struct bstree));
                      temp2=temp2->right;
                      temp2->data=val;
                      temp2->left=NULL;
                      temp2->right=NULL;
              }
       }
}

void bst::postorder_non_rec(bstree *root)
  {
   stack stk;
   stack_int stk1;
   int flag;
   bstree *temp=root;
        do
          {
            if(temp!=NULL)
{
               stk.push(temp);
               stk1.push(1);
               temp=temp->left;
          }
        else
          {
               if(stk.empty())
               break;
               temp=stk.pop();
               flag=stk1.pop();
               if(flag==2)
                 {
                   cout<<temp->data;
                   temp=NULL;
                 }
               else
                 {
                   stk.push(temp);
                   stk1.push(2);
                   temp=temp->right;
                 }
          }
        }while(1);
  }

void bst::preorder_non_rec(bstree *root)
  {
       stack stk;
       bstree *temp=root;
       stk.push(temp);
         while(!stk.empty())
           {
               temp=stk.pop();
               if(temp!=NULL)
                 {
                   cout<<temp->data<<" ";
                   stk.push(temp->right);
                   stk.push(temp->left);
                 }
           }
  }
void bst::inorder_non_rec(bstree *root)
  {
    stack stk;
    bstree *temp;
    if(root!=NULL)
         {
            temp=root;
            do
              {
                 while(temp!=NULL)
                   {
                     stk.push(temp);
                     temp=temp->left;
                   }
                 if(!stk.empty())
                   {
                     temp=stk.pop();
                     cout<<temp->data<<" ";
                     temp=temp->right;
                   }
                 else
                   break;
              }while(1);
         }
    else
      cout<<"Empty tree";
}

void main()
  {
      int info,opt;
      char choice;
      clrscr();
      bst b;
      do
        {
           cout<<"n 1-Insert n 2-Inorder n 3-Preordern 4-Postord n 5. Exitn";
           cout<<"n ENTER YOUR CHOICE:";
           cin>>opt;
              switch(opt)
              {
                     case 1: cout<<"n enter the number :";
                             cin>>info;
                             b.insert(root,info);
                             break;
case 2: cout<<"n Inorder n non recursive display is:";
                              b.inorder_non_rec(root);
                              break;
                      case 3: cout<<"nPreorder n non recursive display is:";
                              b.preorder_non_rec(root);
                              break;
                       case 4: cout<<"n Post order n non recursive display is:";
                               b.postorder_non_rec(root);
                               break;
                      case 5: exit(0);
           }
    }while(1);
}



OUTPUT

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 2

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 67

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 12

         1.Insert
         2.Inorder
         3.Preorder
4.Postorder
5.Exit
Enter your choice: 1
Enter the element: 45

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 1
Enter the element: 74

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 1
Enter the element: 21

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 2
In order
Non recursive display: 2 12 21 45 67 74
1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 3
Pre order
Non recursive display: 2 67 12 45 21 74
1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 4
Post order
Non recursive display: 21 45 12 74 67 2
IMPLEMENTATION OF BINARY SEARCH TREE RECURSIVE TRAVERSAL

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<malloc.h>
#include<process.h>

struct bstree
{
        int data;
        struct bstree*left;
        struct bstree*right;
}*root=NULL;

class bst
  {
    private:

   public :
      void insert(bstree *,int);
      void inorder(bstree*);
      void postorder(bstree *);
      void preorder(bstree *);
      };

class stack
 {
   int top;
   bstree *stackel[20];
   public:
     stack()
          {
            top=-1;
          }
        void push(bstree *);
        bstree* pop();
        int empty()
        {
          if(top==-1)
             return(1);
          else
          return(0);
        }
 };
class stack_int
 {
   int top;
   int stack_int[20];
   public:
    stack_int()
          {
            top=-1;
          }
    void push(int flag);
    int pop();
    int empty_int()
         {
           if(top==-1)
             return(1);
           else
             return(0);
         }
   };

void stack_int::push(int flag)
   {
     stack_int[++top]=flag;
   }
int stack_int::pop()
   {
     return(stack_int[top--]);
   }

void stack::push(bstree *node)
 {
   stackel[++top]=node;
 }

bstree *stack::pop()
 {
   return(stackel[top--]);
 }

void bst :: insert(struct bstree*head,int val)
{
       struct bstree *temp1,*temp2;
       if(head == NULL)
       {
head=(struct bstree*)malloc(sizeof(struct bstree));
               root=head;
               head->data=val;
               head->left=NULL;
               head->right=NULL;
       }
       else
       {
                temp1=head;
                while(temp1 != NULL)
                {
                       temp2=temp1;
                       if(temp1->data > val)
                              temp1=temp1->left;
                       else
                              temp1=temp1->right;
                }
               if(temp2->data > val)
               {
                       temp2->left=(struct bstree*)malloc(sizeof(struct bstree));
                       temp2=temp2->left;
                       temp2->data=val;
                       temp2->left=NULL;
                       temp2->right=NULL;
               }
               else
               {
                       temp2->right=(struct bstree*)malloc(sizeof(struct bstree));
                       temp2=temp2->right;
                       temp2->data=val;
                       temp2->left=NULL;
                       temp2->right=NULL;
               }
       }
}

void bst :: postorder(struct bstree*head)
{
       if( head != NULL)
       {
                postorder(head->left);
                postorder(head->right);
                cout<<head->data;
       }
}
void bst :: preorder(struct bstree*head)
{
       if( head != NULL)
       {
                cout<<head->data;
                preorder(head->left);
                preorder(head->right);
       }
}


void bst::inorder(bstree *root)
  {
    stack stk;
    bstree *temp;
         temp=root;
    if(temp!=NULL)
         {
           inorder(temp->left);
           cout<<temp->data;
           inorder(temp->right);
         }
}

void main()
  {
      int info,opt;
      char choice;
      clrscr();
      bst b;
      do
        {
           cout<<"n 1-Insert n 2-Inorder n 3-Preordern 4-Postorder n 5. Exitn";
           cout<<"n ENTER YOUR CHOICE:";
           cin>>opt;
              switch(opt)
              {
                     case 1: cout<<"n enter the number :";
                             cin>>info;
                             b.insert(root,info);
                             break;
                     case 2:cout<<"n recursive display is:";
                             b.inorder(root);
                             break;
case 3:cout<<"n recursive display is:";
                            b.preorder(root);
                            break;
                     case 4:cout<<"n recursive display is:";
                             b.postorder(root);
                             break;
                    case 5: exit(0);
           }
    }while(1);
}



OUTPUT

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 2

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 67

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
         Enter the element: 12

         1.Insert
         2.Inorder
         3.Preorder
         4.Postorder
         5.Exit
         Enter your choice: 1
Enter the element: 45

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 1
Enter the element: 74

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 1
Enter the element: 21

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 2
In order
Recursive display: 2 12 21 45 67 74

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 3
Pre order
Recursive display: 2 67 12 45 21 74

1.Insert
2.Inorder
3.Preorder
4.Postorder
5.Exit
Enter your choice: 4
Post order
Recursive display: 21 45 12 74 67 2
IMPLEMENTATION OF Breadth First Search

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int cost[10][10],i,j,k,n,qu[10],front,rare,v,visit[10],visited[10];

main()
{
int m;
cout <<"enter no of vertices";
cin >> n;
cout <<"enter no of edges";
cin >> m;
cout <<"nEDGES n";
for(k=1;k<=m;k++)
{
cin >>i>>j;
cost[i][j]=1;
}

cout <<"enter initial vertex";
cin >>v;
cout <<"Visitied verticesn";
cout << v;
visited[v]=1;
k=1;
while(k<n)
{
for(j=1;j<=n;j++)
if(cost[v][j]!=0 && visited[j]!=1 && visit[j]!=1)
{
visit[j]=1;
qu[rare++]=j;
}
v=qu[front++];
cout<<v << " ";
k++;
visit[v]=0; visited[v]=1;
}
}
OUTPUT:
Enter the no of vertices: 9
Enter the no of edges:9
EDGES
   1       2
   2       3
   1       5
   1       4
   4       7
   7       8
   8       9
   2       6
   5       7
   Enter initial vertex: 1

   Visited vertices
                              1   2 4 5 3 6 7 8 9
IMPLEMENTATION OF Depth First Search

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int cost[10][10],i,j,k,n,stk[10],top,v,visit[10],visited[10];

main()
{
int m;
cout <<"enterno of vertices";
cin >> n;
cout <<"ente no of edges";
cin >> m;
cout <<"nEDGES n";
for(k=1;k<=m;k++)
{
cin >>i>>j;
cost[i][j]=1;
}

cout <<"enter initial vertex";
cin >>v;
cout <<" VISITED VERTICES";
cout << v <<" ";
visited[v]=1;
k=1;
while(k<n)
{
for(j=n;j>=1;j--)
if(cost[v][j]!=0 && visited[j]!=1 && visit[j]!=1)
{
visit[j]=1;
stk[top]=j;
top++;
}
v=stk[--top];
cout<<v << " ";
k++;
visit[v]=0; visited[v]=1;
}
}
OUTPUT:

Enter the no of vertices: 9
Enter the no of edges:9
EDGES
   1       2
   2       3
   1       5
   1       4
   4       7
   7       8
   8       9
   2       6
   5       7
   Enter initial vertex: 1

   Visited vertices
   1 2 3 6 4 7 8 9 5
IMPLEMENTATION OF HEAP SORT

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void heapify(int a[],int i);
void buildheap(int a[]);
void heapsort(int a[]);
int n;
void main()
{
int a[100];
clrscr();
cout<<"enter n valuen";
cin>>n;
int l=n;
cout<<"enter array of elementsn";
for(int i=0;i<n;i++)
cin>>a[i];
heapsort(a);
cout<<"the sorted list of elements are:"<<endl;
for(i=0;i<l;i++)
cout<<a[i]<<endl;
getch();
}
void heapify(int a[],int i)
{
int l,r,large;
l=2*i+1;
r=2*i+2;
if(l<n&&a[l]>=a[i])
large=1;
else
large=i;
if(r<n&&a[r]>=a[large])
large=r;
if(i!=large)
{
int t;
t=a[i];
a[i]=a[large];
a[large]=t;
heapify(a,large);
}
}
void buildheap(int a[])
{
 int i;
 for(i=(n/2)-1;i>=0;i--)
 heapify(a,i);
 }
void heapsort(int a[])
 {
 buildheap(a);
 for(int i=n-1;i>=1;i--)
 {
 int t;
 t=a[0];
 a[0]=a[i];
 a[i]=t;
 n--;
 heapify(a,0);
 }
 }




OUTPUT:
enter n value
4
enter array of elements
5
6
3
2
the sorted list of elements are:
2
3
5
6
IMPLEMENTATION OF PROGRAM TO CONVERT INFIX TO POSTFIX FORM

#include<iostream.h>
#include<conio.h>
#include<string.h>
#define MAXSIZE 100
class STACK_ARRAY
{
int stack[MAXSIZE];
int Top;
public:
STACK_ARRAY()
{
Top=-1;
}
void push(char);
char pop();
int prec(char);
void Infix_Postfix();
};
void STACK_ARRAY::push(char item)
{
if (Top == MAXSIZE-1)
{
cout<<"nThe Stack Is Full";
getch();
}
else
stack[++Top]=item;
}
char STACK_ARRAY::pop()
{
char item='#';
if (Top == -1)
cout<<"nThe Stack Is Empty. Invalid Infix expression";
else
item=stack[Top--];
return(item);
}
int STACK_ARRAY::prec(char symbol)
{
switch(symbol)
{
case '(':
return(1);
case ')':
return(2);
case '+':
case '-':
return(3);
case '*':
case '/':
case '%':
return(4);
case '^':
return(5);
default:
return(0);
}
}
void STACK_ARRAY::Infix_Postfix()
{
int len,priority;
char infix[MAXSIZE],postfix[MAXSIZE],ch;
cout<<"nnEnter the infix expression = ";
cin>>infix;
len=strlen(infix);
infix[len++]=')';
push('(');
for(int i=0,j=0;i<len;i++)
{
switch(prec(infix[i]))
{
case 1:
push(infix[i]);
break;
case 2:
ch=pop();
while(ch != '(')
{
postfix[j++]=ch;
ch=pop();
}
break;
case 3:
ch=pop();
while(prec(ch) >= 3)
{
postfix[j++]=ch;
ch=pop();
}
push(ch);
push(infix[i]);
break;
case 4:
ch=pop();
while(prec(ch) >= 4)
{

postfix[j++]=ch;
ch=pop();
}
push(ch);
push(infix[i]);
break;
case 5:
ch=pop();
while(prec(ch) == 5)
{
postfix[j++]=ch;
ch=pop();
}
push(ch);
push(infix[i]);
break;
default:
postfix[j++]=infix[i];
break;
}
}
cout<<"nThe Postfix expression is =";
for(i=0;i<j;i++)
cout<<postfix[i];
}
void main()
{
char choice;
STACK_ARRAY ip;
clrscr();
do
{
clrscr();
ip.Infix_Postfix();
cout<<"nnDo you want to continue (Y/y) =";
cin>>choice;
}while(choice == 'Y' || choice == 'y');
}




OUTPUT:

Enter the infix expression:
A+B
The postfix expression is
AB+
Do you wish to continue(Y/y)= y

Enter the infix expression:
A+(B-C)
The postfix expression is
ABC-+
Do you wish to continue(Y/y)=n

Weitere ähnliche Inhalte

Was ist angesagt?

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
 
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsTypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsAlfonso Peletier
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersAppier
 
C++ L08-Classes Part1
C++ L08-Classes Part1C++ L08-Classes Part1
C++ L08-Classes Part1Mohammad Shaker
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184Mahmoud Samir Fayed
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015Binary Studio
 
Bind me if you can
Bind me if you canBind me if you can
Bind me if you canOvidiu Farauanu
 

Was ist angesagt? (20)

C++ TUTORIAL 10
C++ TUTORIAL 10C++ TUTORIAL 10
C++ TUTORIAL 10
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
C++ TUTORIAL 5
C++ TUTORIAL 5C++ TUTORIAL 5
C++ TUTORIAL 5
 
Oop1
Oop1Oop1
Oop1
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
C++ TUTORIAL 9
C++ TUTORIAL 9C++ TUTORIAL 9
C++ TUTORIAL 9
 
Ss
SsSs
Ss
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Cquestions
Cquestions Cquestions
Cquestions
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duo
 
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsTypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python Programmers
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
C++ L08-Classes Part1
C++ L08-Classes Part1C++ L08-Classes Part1
C++ L08-Classes Part1
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
Bind me if you can
Bind me if you canBind me if you can
Bind me if you can
 

Andere mochten auch

Neil Armstrong Hall of Engineering
Neil Armstrong Hall of EngineeringNeil Armstrong Hall of Engineering
Neil Armstrong Hall of Engineeringseunghoon91
 
South park middle school
South park middle schoolSouth park middle school
South park middle schoolhvolrie
 
Ds program-print
Ds program-printDs program-print
Ds program-printChaitanya Kn
 
Presentation1
Presentation1Presentation1
Presentation1Chaitanya Kn
 
Texas STaR Chart Powerpoint
Texas STaR Chart PowerpointTexas STaR Chart Powerpoint
Texas STaR Chart Powerpointstevetaylor18
 
South park middle school
South park middle schoolSouth park middle school
South park middle schoolhvolrie
 
Week 4 - Technology Action Plan
Week 4 - Technology Action PlanWeek 4 - Technology Action Plan
Week 4 - Technology Action Planstevetaylor18
 
Fantastic trip by nasa
Fantastic trip by nasaFantastic trip by nasa
Fantastic trip by nasaChaitanya Kn
 

Andere mochten auch (10)

Neil Armstrong Hall of Engineering
Neil Armstrong Hall of EngineeringNeil Armstrong Hall of Engineering
Neil Armstrong Hall of Engineering
 
South park middle school
South park middle schoolSouth park middle school
South park middle school
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
Dbms 2
Dbms 2Dbms 2
Dbms 2
 
Presentation1
Presentation1Presentation1
Presentation1
 
Texas STaR Chart Powerpoint
Texas STaR Chart PowerpointTexas STaR Chart Powerpoint
Texas STaR Chart Powerpoint
 
South park middle school
South park middle schoolSouth park middle school
South park middle school
 
Week 4 - Technology Action Plan
Week 4 - Technology Action PlanWeek 4 - Technology Action Plan
Week 4 - Technology Action Plan
 
Dbms print
Dbms printDbms print
Dbms print
 
Fantastic trip by nasa
Fantastic trip by nasaFantastic trip by nasa
Fantastic trip by nasa
 

Ă„hnlich wie Ds 2 cycle

#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdfharihelectronicspune
 
Linked list imp of list
Linked list imp of listLinked list imp of list
Linked list imp of listElavarasi K
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxteyaj1
 
This is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdfThis is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdfkostikjaylonshaewe47
 
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfDoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfaathiauto
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdfKUNALHARCHANDANI1
 
Implement of c &amp; its coding programming by sarmad baloch
Implement of c &amp; its coding  programming by sarmad balochImplement of c &amp; its coding  programming by sarmad baloch
Implement of c &amp; its coding programming by sarmad balochSarmad Baloch
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdfanupambedcovers
 
#include iostream #includestdlib.h using namespace std;str.pdf
#include iostream #includestdlib.h using namespace std;str.pdf#include iostream #includestdlib.h using namespace std;str.pdf
#include iostream #includestdlib.h using namespace std;str.pdflakshmijewellery
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdffantoosh1
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)Ankit Gupta
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
 
Need help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxNeed help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxJason0x0Scottw
 
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdfincludestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdfgalagirishp
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresLakshmi Sarvani Videla
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfforladies
 

Ă„hnlich wie Ds 2 cycle (20)

#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf#includeiostream #includecstdio #includecstdlib using na.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
 
Linked list imp of list
Linked list imp of listLinked list imp of list
Linked list imp of list
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docx
 
Snake.c
Snake.cSnake.c
Snake.c
 
This is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdfThis is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdf
 
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdfDoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
DoublyList-cpp- #include -DoublyList-h- using namespace std- void Doub.pdf
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf#includeiostream#includecstdio#includecstdlibusing names.pdf
#includeiostream#includecstdio#includecstdlibusing names.pdf
 
Implement of c &amp; its coding programming by sarmad baloch
Implement of c &amp; its coding  programming by sarmad balochImplement of c &amp; its coding  programming by sarmad baloch
Implement of c &amp; its coding programming by sarmad baloch
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdf
 
#include iostream #includestdlib.h using namespace std;str.pdf
#include iostream #includestdlib.h using namespace std;str.pdf#include iostream #includestdlib.h using namespace std;str.pdf
#include iostream #includestdlib.h using namespace std;str.pdf
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
Need help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxNeed help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docx
 
C program
C programC program
C program
 
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdfincludestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
 
Dsprograms(2nd cse)
Dsprograms(2nd cse)Dsprograms(2nd cse)
Dsprograms(2nd cse)
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
 

Mehr von Chaitanya Kn

Black box-software-testing-douglas-hoffman2483
Black box-software-testing-douglas-hoffman2483Black box-software-testing-douglas-hoffman2483
Black box-software-testing-douglas-hoffman2483Chaitanya Kn
 
Jpdcs1 data leakage detection
Jpdcs1 data leakage detectionJpdcs1 data leakage detection
Jpdcs1 data leakage detectionChaitanya Kn
 
Jpdcs1(data lekage detection)
Jpdcs1(data lekage detection)Jpdcs1(data lekage detection)
Jpdcs1(data lekage detection)Chaitanya Kn
 
(Cse cs) ads programs list
(Cse  cs) ads programs list(Cse  cs) ads programs list
(Cse cs) ads programs listChaitanya Kn
 
Testing primer
Testing primerTesting primer
Testing primerChaitanya Kn
 
Unix lab manual
Unix lab manualUnix lab manual
Unix lab manualChaitanya Kn
 
Stop complaining
Stop complainingStop complaining
Stop complainingChaitanya Kn
 

Mehr von Chaitanya Kn (11)

Black box-software-testing-douglas-hoffman2483
Black box-software-testing-douglas-hoffman2483Black box-software-testing-douglas-hoffman2483
Black box-software-testing-douglas-hoffman2483
 
Nano tech
Nano techNano tech
Nano tech
 
Jpdcs1 data leakage detection
Jpdcs1 data leakage detectionJpdcs1 data leakage detection
Jpdcs1 data leakage detection
 
Jpdcs1(data lekage detection)
Jpdcs1(data lekage detection)Jpdcs1(data lekage detection)
Jpdcs1(data lekage detection)
 
(Cse cs) ads programs list
(Cse  cs) ads programs list(Cse  cs) ads programs list
(Cse cs) ads programs list
 
Testing primer
Testing primerTesting primer
Testing primer
 
Stm unit1
Stm unit1Stm unit1
Stm unit1
 
Unix lab manual
Unix lab manualUnix lab manual
Unix lab manual
 
Stop complaining
Stop complainingStop complaining
Stop complaining
 
God doesn
God doesnGod doesn
God doesn
 
Os 2 cycle
Os 2 cycleOs 2 cycle
Os 2 cycle
 

KĂĽrzlich hochgeladen

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

KĂĽrzlich hochgeladen (20)

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Ds 2 cycle

  • 1. IMPLEMENTATION OF QUEUE USING LINKED LIST #include<iostream.h> #include<process.h> #include<conio.h> class equeue { struct node { int info; node *next; }*front,*rear; public:equeue() { front=rear=NULL; } void insert(void); void deleted(void); void display(void); }; void equeue::insert() { node *temp=new node; cout<<"n Enter Value To Insert:"; cin>>temp->info; temp->next=NULL; if(front==NULL) { front=rear=temp; } else { rear->next=temp; rear=rear->next; } } void equeue::deleted() { if(front==NULL) { cout<<"n Queue Is Emptyn"; } else
  • 2. { if(front==rear) { cout<<"n Deleted Element Is :"<<front->info; front=rear=NULL; } else { node *temp=front; cout<<"n Deleted Element Is :"<<temp->info; front=front->next; delete(temp); } } } void equeue::display() { if(front==NULL) cout<<"Queue Is Emptyn"; else { node *t=front; while(t->next!=NULL) { cout<<t->info<<"n"; t=t->next; } cout<<t->info; } } void main() { equeue c; int ch; clrscr(); while(1) { cout<<"n 1.Insertn 2.Deleten 3.Displayn 4.Exitn"; cout<<"n Enter Your Choice:"; cin>>ch; switch(ch) { case 1:c.insert();
  • 3. break; case 2:c.deleted(); break; case 3:c.display(); break; case 4:exit(0); break; default:cout<<"n Enter The Right Choice"; } } } OUTPUT: 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice: 1 Enter the value to insert: 11 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice: 1 Enter the value to insert:22 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice: 1 Enter the value to insert:33 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice: 3 11 22 33
  • 4. 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice:2 Deleted Element is: 11 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice:2 Deleted Element is: 22 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice:2 Deleted Element is: 33 1.Insert 2.Delete 3.Display 4.Exit Enter Your Choice:3 Queue is Empty
  • 5. IMPLEMENTATION OF DOUBLE LINKED LIST #include <iostream.h> #include<MEMMGR.H> #include<process.h> #include<conio.h> class dllist { struct node { int value; struct node *next; struct node *prev; }; struct node *start; public: dllist() { start=NULL; } void insertbegin(int value); void insertend(int value); void insertmiddle(int value,int nvalue); void deletebegin(); void deleteend(); void deletemiddle(int value); void display(); }; void dllist::insertmiddle(int value,int nvalue) { struct node *temp,*curr,*ncurr; temp=(struct node*)new (struct node); temp->value=value; curr=start; while(curr->value!=nvalue) { curr=curr->next; } temp->prev=curr; temp->next=curr->next; curr->next=temp; }
  • 6. void dllist::insertbegin(int value) { struct node *temp; temp=(struct node*)new (struct node); temp->value=value; if(start==NULL) { temp->prev=NULL; temp->next=NULL; start=temp; } else { temp->next=start; temp->prev=NULL; start=temp; } } void dllist::insertend(int value) { struct node *temp,*curr; temp=(struct node *)new(struct node); temp->value=value; curr=start; while(curr->next!=NULL) { curr=curr->next; } temp->prev=curr; curr->next=temp; temp->next=NULL; } void dllist::deletebegin() { struct node *curr; curr=start; start=curr->next; start->prev=NULL; cout<<curr->value; free(curr); } void dllist::deleteend()
  • 7. { struct node *curr=start,*pcurr; while(curr->next!=NULL) { pcurr=curr; curr=curr->next; } pcurr->next=NULL; cout<<curr->value; free(curr); } void dllist::deletemiddle(int value) { struct node *curr=start,*pcurr,*ncurr; pcurr=ncurr=start; while(curr->value!=value) { pcurr=curr; curr=curr->next; } ncurr=curr->next; pcurr->next=curr->next; ncurr->prev=curr->prev; cout<<"deleted element:"<<curr->value; free(curr); } void dllist::display() { struct node *curr; curr=start; cout<<"nThe list is :n"; if(curr==NULL) cout<<"list is empty"; else { while(curr->next!=NULL) { cout<<curr->value<<"->"; curr=curr->next; } cout<<curr->value; }
  • 8. } void main() { int ch1,ch2,num,nd; dllist st; clrscr(); while(1) { cout<<"n1.Insertn2.Deleten3.Displayn4.Exitn"; cin>>ch1; switch(ch1) { case 1: { cout<<"nInsert :n1.Beginningn2.Endn3.Middlen"; cin>>ch2; switch(ch2) { case 1: { cout<<"enter the element:"; cin>>num; st.insertbegin(num); break; } case 2: { cout<<"enter the element:"; cin>>num; st.insertend(num); break; } case 3: { cout<<"enter the node after which to insert:"; cin>>nd; cout<<"enter the element:"; cin>>num; st.insertmiddle(num,nd); break; } default: cout<<"enter the correct choice"; } break;
  • 9. } case 2: { cout<<"nDelete:n1.Beginningn2.Endn3.Middle"; cin>>ch2; switch(ch2) { case 1: { cout<<"Deletion fron beginning:"; st.deletebegin(); break; } case 2: { cout<<"Deletion from the end:"; st.deleteend(); break; } case 3: { cout<<"enter the node to be deleted:"; cin>>nd; st.deletemiddle(nd); break; } default: cout<<"enter the correct choice"; } break; } case 3: { st.display(); break; } case 4:exit(0); default: cout<<"enter the correct choice"; } } }
  • 10. OUTPUT: 1.Insert 2.Delete 3.Display 4.Exit Enter your choice: 1 Insert: 1.Beginning 2.End 3.Middle 1 Enter the element:11 1.Insert 2.Delete 3.Display 4.Exit Enter your choice:1 Insert: 1.Beginning 2.End 3.Middle 2 Enter the element:22 1.Insert 2.Delete 3.Display 4.Exit Enter your choice:1 Insert: 1.Beginning 2.End 3.Middle 3 Enter the node after which to insert:11 Enter the element:33 1.Insert 2.Delete 3.Display 4.Exit
  • 11. Enter your choice:3 11->33->22 1.Insert 2.Delete 3.Display 4.Exit Enter your choice:2 Delete: 1.Beginning 2.End 3.Middle 3 Enter the node to be deleted: 33 Deleted element :33 1.Insert 2.Delete 3.Display 4.Exit Enter your choice:2 Delete: 1.Beginning 2.End 3.Middle 1 Deletion from the beginning 11 1.Insert 2.Delete 3.Display 4.Exit Enter your choice:2 Delete: 1.Beginning 2.End 3.Middle 2 Deletion from the end 22
  • 12. IMPLEMNTATION OF BINARY SEARCH TREE NON RECURSIVE TRAVERSAL #include<iostream.h> #include<conio.h> #include<stdio.h> #include<malloc.h> #include<process.h> struct bstree { int data; struct bstree*left; struct bstree*right; }*root=NULL; class bst { private: public : void insert(bstree *,int); void inorder_non_rec(bstree*); void preorder_non_rec(bstree*); void postorder_non_rec(bstree*); }; class stack { int top; bstree *stackel[20]; public: stack() { top=-1; } void push(bstree *); bstree* pop(); int empty() { if(top==-1) return(1); else return(0); } };
  • 13. class stack_int { int top; int stack_int[20]; public: stack_int() { top=-1; } void push(int flag); int pop(); int empty_int() { if(top==-1) return(1); else return(0); } }; void stack_int::push(int flag) { stack_int[++top]=flag; } int stack_int::pop() { return(stack_int[top--]); } void stack::push(bstree *node) { stackel[++top]=node; } bstree *stack::pop() { return(stackel[top--]); } void bst :: insert(struct bstree*head,int val) { struct bstree *temp1,*temp2; if(head == NULL) {
  • 14. head=(struct bstree*)malloc(sizeof(struct bstree)); root=head; head->data=val; head->left=NULL; head->right=NULL; } else { temp1=head; while(temp1 != NULL) { temp2=temp1; if(temp1->data > val) temp1=temp1->left; else temp1=temp1->right; } if(temp2->data > val) { temp2->left=(struct bstree*)malloc(sizeof(struct bstree)); temp2=temp2->left; temp2->data=val; temp2->left=NULL; temp2->right=NULL; } else { temp2->right=(struct bstree*)malloc(sizeof(struct bstree)); temp2=temp2->right; temp2->data=val; temp2->left=NULL; temp2->right=NULL; } } } void bst::postorder_non_rec(bstree *root) { stack stk; stack_int stk1; int flag; bstree *temp=root; do { if(temp!=NULL)
  • 15. { stk.push(temp); stk1.push(1); temp=temp->left; } else { if(stk.empty()) break; temp=stk.pop(); flag=stk1.pop(); if(flag==2) { cout<<temp->data; temp=NULL; } else { stk.push(temp); stk1.push(2); temp=temp->right; } } }while(1); } void bst::preorder_non_rec(bstree *root) { stack stk; bstree *temp=root; stk.push(temp); while(!stk.empty()) { temp=stk.pop(); if(temp!=NULL) { cout<<temp->data<<" "; stk.push(temp->right); stk.push(temp->left); } } }
  • 16. void bst::inorder_non_rec(bstree *root) { stack stk; bstree *temp; if(root!=NULL) { temp=root; do { while(temp!=NULL) { stk.push(temp); temp=temp->left; } if(!stk.empty()) { temp=stk.pop(); cout<<temp->data<<" "; temp=temp->right; } else break; }while(1); } else cout<<"Empty tree"; } void main() { int info,opt; char choice; clrscr(); bst b; do { cout<<"n 1-Insert n 2-Inorder n 3-Preordern 4-Postord n 5. Exitn"; cout<<"n ENTER YOUR CHOICE:"; cin>>opt; switch(opt) { case 1: cout<<"n enter the number :"; cin>>info; b.insert(root,info); break;
  • 17. case 2: cout<<"n Inorder n non recursive display is:"; b.inorder_non_rec(root); break; case 3: cout<<"nPreorder n non recursive display is:"; b.preorder_non_rec(root); break; case 4: cout<<"n Post order n non recursive display is:"; b.postorder_non_rec(root); break; case 5: exit(0); } }while(1); } OUTPUT 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 2 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 67 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 12 1.Insert 2.Inorder 3.Preorder
  • 18. 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 45 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 21 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 2 In order Non recursive display: 2 12 21 45 67 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 3 Pre order Non recursive display: 2 67 12 45 21 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 4 Post order Non recursive display: 21 45 12 74 67 2
  • 19. IMPLEMENTATION OF BINARY SEARCH TREE RECURSIVE TRAVERSAL #include<iostream.h> #include<conio.h> #include<stdio.h> #include<malloc.h> #include<process.h> struct bstree { int data; struct bstree*left; struct bstree*right; }*root=NULL; class bst { private: public : void insert(bstree *,int); void inorder(bstree*); void postorder(bstree *); void preorder(bstree *); }; class stack { int top; bstree *stackel[20]; public: stack() { top=-1; } void push(bstree *); bstree* pop(); int empty() { if(top==-1) return(1); else return(0); } };
  • 20. class stack_int { int top; int stack_int[20]; public: stack_int() { top=-1; } void push(int flag); int pop(); int empty_int() { if(top==-1) return(1); else return(0); } }; void stack_int::push(int flag) { stack_int[++top]=flag; } int stack_int::pop() { return(stack_int[top--]); } void stack::push(bstree *node) { stackel[++top]=node; } bstree *stack::pop() { return(stackel[top--]); } void bst :: insert(struct bstree*head,int val) { struct bstree *temp1,*temp2; if(head == NULL) {
  • 21. head=(struct bstree*)malloc(sizeof(struct bstree)); root=head; head->data=val; head->left=NULL; head->right=NULL; } else { temp1=head; while(temp1 != NULL) { temp2=temp1; if(temp1->data > val) temp1=temp1->left; else temp1=temp1->right; } if(temp2->data > val) { temp2->left=(struct bstree*)malloc(sizeof(struct bstree)); temp2=temp2->left; temp2->data=val; temp2->left=NULL; temp2->right=NULL; } else { temp2->right=(struct bstree*)malloc(sizeof(struct bstree)); temp2=temp2->right; temp2->data=val; temp2->left=NULL; temp2->right=NULL; } } } void bst :: postorder(struct bstree*head) { if( head != NULL) { postorder(head->left); postorder(head->right); cout<<head->data; } }
  • 22. void bst :: preorder(struct bstree*head) { if( head != NULL) { cout<<head->data; preorder(head->left); preorder(head->right); } } void bst::inorder(bstree *root) { stack stk; bstree *temp; temp=root; if(temp!=NULL) { inorder(temp->left); cout<<temp->data; inorder(temp->right); } } void main() { int info,opt; char choice; clrscr(); bst b; do { cout<<"n 1-Insert n 2-Inorder n 3-Preordern 4-Postorder n 5. Exitn"; cout<<"n ENTER YOUR CHOICE:"; cin>>opt; switch(opt) { case 1: cout<<"n enter the number :"; cin>>info; b.insert(root,info); break; case 2:cout<<"n recursive display is:"; b.inorder(root); break;
  • 23. case 3:cout<<"n recursive display is:"; b.preorder(root); break; case 4:cout<<"n recursive display is:"; b.postorder(root); break; case 5: exit(0); } }while(1); } OUTPUT 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 2 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 67 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 12 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1
  • 24. Enter the element: 45 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 1 Enter the element: 21 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 2 In order Recursive display: 2 12 21 45 67 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 3 Pre order Recursive display: 2 67 12 45 21 74 1.Insert 2.Inorder 3.Preorder 4.Postorder 5.Exit Enter your choice: 4 Post order Recursive display: 21 45 12 74 67 2
  • 25. IMPLEMENTATION OF Breadth First Search #include<iostream.h> #include<conio.h> #include<stdlib.h> int cost[10][10],i,j,k,n,qu[10],front,rare,v,visit[10],visited[10]; main() { int m; cout <<"enter no of vertices"; cin >> n; cout <<"enter no of edges"; cin >> m; cout <<"nEDGES n"; for(k=1;k<=m;k++) { cin >>i>>j; cost[i][j]=1; } cout <<"enter initial vertex"; cin >>v; cout <<"Visitied verticesn"; cout << v; visited[v]=1; k=1; while(k<n) { for(j=1;j<=n;j++) if(cost[v][j]!=0 && visited[j]!=1 && visit[j]!=1) { visit[j]=1; qu[rare++]=j; } v=qu[front++]; cout<<v << " "; k++; visit[v]=0; visited[v]=1; } }
  • 26. OUTPUT: Enter the no of vertices: 9 Enter the no of edges:9 EDGES 1 2 2 3 1 5 1 4 4 7 7 8 8 9 2 6 5 7 Enter initial vertex: 1 Visited vertices 1 2 4 5 3 6 7 8 9
  • 27. IMPLEMENTATION OF Depth First Search #include<iostream.h> #include<conio.h> #include<stdlib.h> int cost[10][10],i,j,k,n,stk[10],top,v,visit[10],visited[10]; main() { int m; cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"nEDGES n"; for(k=1;k<=m;k++) { cin >>i>>j; cost[i][j]=1; } cout <<"enter initial vertex"; cin >>v; cout <<" VISITED VERTICES"; cout << v <<" "; visited[v]=1; k=1; while(k<n) { for(j=n;j>=1;j--) if(cost[v][j]!=0 && visited[j]!=1 && visit[j]!=1) { visit[j]=1; stk[top]=j; top++; } v=stk[--top]; cout<<v << " "; k++; visit[v]=0; visited[v]=1; } }
  • 28. OUTPUT: Enter the no of vertices: 9 Enter the no of edges:9 EDGES 1 2 2 3 1 5 1 4 4 7 7 8 8 9 2 6 5 7 Enter initial vertex: 1 Visited vertices 1 2 3 6 4 7 8 9 5
  • 29. IMPLEMENTATION OF HEAP SORT #include<iostream.h> #include<conio.h> #include<stdio.h> void heapify(int a[],int i); void buildheap(int a[]); void heapsort(int a[]); int n; void main() { int a[100]; clrscr(); cout<<"enter n valuen"; cin>>n; int l=n; cout<<"enter array of elementsn"; for(int i=0;i<n;i++) cin>>a[i]; heapsort(a); cout<<"the sorted list of elements are:"<<endl; for(i=0;i<l;i++) cout<<a[i]<<endl; getch(); } void heapify(int a[],int i) { int l,r,large; l=2*i+1; r=2*i+2; if(l<n&&a[l]>=a[i]) large=1; else large=i; if(r<n&&a[r]>=a[large]) large=r; if(i!=large) { int t; t=a[i]; a[i]=a[large]; a[large]=t; heapify(a,large); } }
  • 30. void buildheap(int a[]) { int i; for(i=(n/2)-1;i>=0;i--) heapify(a,i); } void heapsort(int a[]) { buildheap(a); for(int i=n-1;i>=1;i--) { int t; t=a[0]; a[0]=a[i]; a[i]=t; n--; heapify(a,0); } } OUTPUT: enter n value 4 enter array of elements 5 6 3 2 the sorted list of elements are: 2 3 5 6
  • 31. IMPLEMENTATION OF PROGRAM TO CONVERT INFIX TO POSTFIX FORM #include<iostream.h> #include<conio.h> #include<string.h> #define MAXSIZE 100 class STACK_ARRAY { int stack[MAXSIZE]; int Top; public: STACK_ARRAY() { Top=-1; } void push(char); char pop(); int prec(char); void Infix_Postfix(); }; void STACK_ARRAY::push(char item) { if (Top == MAXSIZE-1) { cout<<"nThe Stack Is Full"; getch(); } else stack[++Top]=item; } char STACK_ARRAY::pop() { char item='#'; if (Top == -1) cout<<"nThe Stack Is Empty. Invalid Infix expression"; else item=stack[Top--]; return(item); } int STACK_ARRAY::prec(char symbol) { switch(symbol) { case '(': return(1);
  • 32. case ')': return(2); case '+': case '-': return(3); case '*': case '/': case '%': return(4); case '^': return(5); default: return(0); } } void STACK_ARRAY::Infix_Postfix() { int len,priority; char infix[MAXSIZE],postfix[MAXSIZE],ch; cout<<"nnEnter the infix expression = "; cin>>infix; len=strlen(infix); infix[len++]=')'; push('('); for(int i=0,j=0;i<len;i++) { switch(prec(infix[i])) { case 1: push(infix[i]); break; case 2: ch=pop(); while(ch != '(') { postfix[j++]=ch; ch=pop(); } break; case 3: ch=pop(); while(prec(ch) >= 3) { postfix[j++]=ch; ch=pop();
  • 33. } push(ch); push(infix[i]); break; case 4: ch=pop(); while(prec(ch) >= 4) { postfix[j++]=ch; ch=pop(); } push(ch); push(infix[i]); break; case 5: ch=pop(); while(prec(ch) == 5) { postfix[j++]=ch; ch=pop(); } push(ch); push(infix[i]); break; default: postfix[j++]=infix[i]; break; } } cout<<"nThe Postfix expression is ="; for(i=0;i<j;i++) cout<<postfix[i]; } void main() { char choice; STACK_ARRAY ip; clrscr(); do { clrscr(); ip.Infix_Postfix(); cout<<"nnDo you want to continue (Y/y) ="; cin>>choice;
  • 34. }while(choice == 'Y' || choice == 'y'); } OUTPUT: Enter the infix expression: A+B The postfix expression is AB+ Do you wish to continue(Y/y)= y Enter the infix expression: A+(B-C) The postfix expression is ABC-+ Do you wish to continue(Y/y)=n