logging in or signing up DQ_SC sancharid Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 12 Category: Science & Tech.. License: All Rights Reserved Like it (0) Dislike it (0) Added: October 27, 2010 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Slide 1: Program -- DQ_SC Slide 2: import java.io.*; class DeQueue { int Dque[]=new int[200]; int F,R,capacity,val; DeQueue() { for(int i=0;i<200;i++) { Dque[i]=0; } } Slide 3: DeQueue(int nx,int nf,int nr) { capacity=nx; F=nf=-1; R=nr=-1; } void PushAtRear(int num) { if(R==capacity-1) System.out.println("The Dequeue is overflow "); else { R++; Dque[R]=num; } } Slide 4: void PushAtFront(int num) { if(F==0) System.out.println("The Dequeue is overflow "); else { F--; Dque[F]=num; } } Slide 5: int RemoveFront() { if(F==-1&&R==-1) { System.out.println("DeQueue is empty"); return -999; } else { val=Dque[F]; if(F==R) { F=-1; R=-1; } else F=F+1; return val; } } Slide 6: int RemoveRear() { if(F>R||F==-1||R==-1) { System.out.println("The DeQueue is empty"); return -999; } else { val=Dque[R]; R--; return val; } } Slide 7: void DqueueDisplay() { if(F>R||F==-1||R==-1) { System.out.println("The DeQueue is underflow"); } else { System.out.println("The elements in Dequeue are :"); for(int j=F;j<=R;j++) System.out. println(Dque[j]); } } Slide 8: public static void main(String args[])throws IOException { int ch; InputStreamReader ir=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(ir); DeQueue ob=new DeQueue(); do { System.out.println("Push At Rear - 1:"); System.out.println("Push At Front - 2:"); Slide 9: System.out.println("Remove From Front - 3"); System.out.println("Remove From Rear - 4"); System.out.println("Display Dequeue - 5 :"); System.out.println("Quit -6:"); System.out.println("Enter your choice"); ch=Integer.parseInt(br.readLine()); Slide 10: switch(ch) { case 1: System.out.println("Enter the data to be pushed at Rear "); int k=Integer.parseInt(br.readLine()); ob.PushAtRear(k); break; case 2: System.out.println("Enter the data to be pushed at Front "); int m=Integer.parseInt(br.readLine()); ob.PushAtFront(m); break; Slide 11: case 3: ob.RemoveFront(); break; case 4: ob.RemoveRear(); break; case 5: ob.DqueueDisplay(); break; } } while(ch!=6); } } You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
DQ_SC sancharid Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 12 Category: Science & Tech.. License: All Rights Reserved Like it (0) Dislike it (0) Added: October 27, 2010 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Slide 1: Program -- DQ_SC Slide 2: import java.io.*; class DeQueue { int Dque[]=new int[200]; int F,R,capacity,val; DeQueue() { for(int i=0;i<200;i++) { Dque[i]=0; } } Slide 3: DeQueue(int nx,int nf,int nr) { capacity=nx; F=nf=-1; R=nr=-1; } void PushAtRear(int num) { if(R==capacity-1) System.out.println("The Dequeue is overflow "); else { R++; Dque[R]=num; } } Slide 4: void PushAtFront(int num) { if(F==0) System.out.println("The Dequeue is overflow "); else { F--; Dque[F]=num; } } Slide 5: int RemoveFront() { if(F==-1&&R==-1) { System.out.println("DeQueue is empty"); return -999; } else { val=Dque[F]; if(F==R) { F=-1; R=-1; } else F=F+1; return val; } } Slide 6: int RemoveRear() { if(F>R||F==-1||R==-1) { System.out.println("The DeQueue is empty"); return -999; } else { val=Dque[R]; R--; return val; } } Slide 7: void DqueueDisplay() { if(F>R||F==-1||R==-1) { System.out.println("The DeQueue is underflow"); } else { System.out.println("The elements in Dequeue are :"); for(int j=F;j<=R;j++) System.out. println(Dque[j]); } } Slide 8: public static void main(String args[])throws IOException { int ch; InputStreamReader ir=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(ir); DeQueue ob=new DeQueue(); do { System.out.println("Push At Rear - 1:"); System.out.println("Push At Front - 2:"); Slide 9: System.out.println("Remove From Front - 3"); System.out.println("Remove From Rear - 4"); System.out.println("Display Dequeue - 5 :"); System.out.println("Quit -6:"); System.out.println("Enter your choice"); ch=Integer.parseInt(br.readLine()); Slide 10: switch(ch) { case 1: System.out.println("Enter the data to be pushed at Rear "); int k=Integer.parseInt(br.readLine()); ob.PushAtRear(k); break; case 2: System.out.println("Enter the data to be pushed at Front "); int m=Integer.parseInt(br.readLine()); ob.PushAtFront(m); break; Slide 11: case 3: ob.RemoveFront(); break; case 4: ob.RemoveRear(); break; case 5: ob.DqueueDisplay(); break; } } while(ch!=6); } }