Page 627 - Computer science 868 Class 12
P. 627

56      voiddelrear()
                   57      {

                   58      if(f==-1&&r==-1)
                   59      {
                   60      System.out.println("Queue empty");

                   61      }

                   62      else if(f<=r)
                   63      {
                   64      System.out.println("Deleting"+a[r]);

                   65      r--;
                   66      }

                   67      else
                   68      {

                   69      System.out.println("Queue empty");
                   70      }

                   71      }
                   72      void display()

                   73      {
                   74      for(int i=f;i<=r;i++)

                   75      {
                   76      System.out.println(a[i]+",");

                   77      }
                   78      }

                   79      public static void main()
                   80      {

                   81      Scanner sc = new Scanner(System.in);
                   82      dqueob = new dque(5);

                   83      intx,y,ch;
                   84      do
                   85      {


                   86          System.out.println("1. Insert from rear 2. Insert from front 3. Empty from
                               rear 4. Empty from front 5. Display");
                   87      ch = sc.nextInt();

                   88      switch(ch)
                   89      {




                                                                                                                       625
                                                                                                   Internal Assessment  625
   622   623   624   625   626   627   628   629   630   631   632