Page 626 - Computer science 868 Class 12
P. 626
22 }
23 void addfront(int x)
24 {
25 if(f==-1&&r==-1)
26 {
27 a[++f]=x;
28 r=0;
29 }
30 else if(f>0&&r<=n-1)
31 {
32 f--;
33 a[f]=x;
34 }
35 else
36 {
37 System.out.println("queue full");
38 }
39 }
40 void delfront()
41 {
42 if(f==-1&&r==-1)
43 {
44 System.out.println("Empty Queue");
45 }
46 else if(f<=r)
47 {
48 System.out.println("Deleting"+a[f]);
49 f++;
50 }
51 else
52 {
53 System.out.println("Queue empty");
54 }
55 }
624624 Touchpad Computer Science-XII

