logging in or signing up linear Queue aSGuest17241 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: 1704 Category: Education License: All Rights Reserved Like it (3) Dislike it (0) Added: April 21, 2009 This Presentation is Public Favorites: 2 Presentation Description No description available. Comments Posting comment... By: amandeep911 (13 month(s) ago) plz send me this ppt at aman_deep_khurana@yahoo.com Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript : Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queues Linear Data structure Concept: First in First out Defn: Ordered collection of items Slide 2: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Temple for Darshanam Slide 3: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Barber Shop Slide 4: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Hospital Slide 5: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue for a Dinner Slide 6: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue for a Toilet Slide 7: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Operations on Q Insert Delete Display Q Status Q full or overflow Q Empty / underflow Slide 8: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR TYPES OF Q 1 Ordinary Q or Linear Q 2 Double ended Q [Deque] 3 Circular Q 4 Priority Q Slide 9: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Terminologies and Status Q Full or Overflow : Q Empty or Underflow Rear : Inserting an element Front : Deleting or removing an element from the queue Slide 10: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR 23 78 Front 56 Rear Items Insert Delete Representation of Linear Queue Linear Queue using an Array q[0] q[1] q[2] Slide 11: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR OPERATIONS ON Q Enqueuing : Adding an Element to the q Dequeuing : Removing an element from the q Slide 12: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR LINEAR QUEUE Algorithm to Add an Element // Q is an array // N is the Max size // r : rear :-1 // f : front :0 If (r==n-1) Then write “ Q FULL” else r=r+1 Q[r]=item; // Item is stored in an array Slide 13: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Algorithm to Delete an Element // Q is an array Q[0…n-1] // n is maxsize of the queue // f and r are front and rear f=0,r=-1 If(r == -1) Then write “ Q Underflow” else Item=Q[f] If f > r F=0,r=-1; else f=f+1 return item Slide 14: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - f r 0 1 2 3 4 Insert Operation Slide 15: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 2 3 4 Insert Operation Slide 16: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 2 3 4 Insert Operation Slide 17: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 4 Insert Operation Slide 18: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 3 Insert Operation Slide 19: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 4 0 4 4 4 3 4 Q Full Slide 20: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 4 4 3 3 3 4 Delete Operation Slide 21: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 8 8 2 8 3 5 5 5 4 4 4 4 3 4 Delete Operation Slide 22: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 5 5 5 4 4 3 3 3 4 Delete Operation Slide 23: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 4 4 4 3 4 Delete Operation Slide 24: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 3 4 Delete Operation 4 4 5 4 Front > Rear Reinitialize f=0 , r=-1 Slide 25: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Slide 26: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Thank U.... JVG You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
linear Queue aSGuest17241 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: 1704 Category: Education License: All Rights Reserved Like it (3) Dislike it (0) Added: April 21, 2009 This Presentation is Public Favorites: 2 Presentation Description No description available. Comments Posting comment... By: amandeep911 (13 month(s) ago) plz send me this ppt at aman_deep_khurana@yahoo.com Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript : Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queues Linear Data structure Concept: First in First out Defn: Ordered collection of items Slide 2: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Temple for Darshanam Slide 3: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Barber Shop Slide 4: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue in a Hospital Slide 5: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue for a Dinner Slide 6: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Queue for a Toilet Slide 7: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Operations on Q Insert Delete Display Q Status Q full or overflow Q Empty / underflow Slide 8: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR TYPES OF Q 1 Ordinary Q or Linear Q 2 Double ended Q [Deque] 3 Circular Q 4 Priority Q Slide 9: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Terminologies and Status Q Full or Overflow : Q Empty or Underflow Rear : Inserting an element Front : Deleting or removing an element from the queue Slide 10: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR 23 78 Front 56 Rear Items Insert Delete Representation of Linear Queue Linear Queue using an Array q[0] q[1] q[2] Slide 11: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR OPERATIONS ON Q Enqueuing : Adding an Element to the q Dequeuing : Removing an element from the q Slide 12: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR LINEAR QUEUE Algorithm to Add an Element // Q is an array // N is the Max size // r : rear :-1 // f : front :0 If (r==n-1) Then write “ Q FULL” else r=r+1 Q[r]=item; // Item is stored in an array Slide 13: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Algorithm to Delete an Element // Q is an array Q[0…n-1] // n is maxsize of the queue // f and r are front and rear f=0,r=-1 If(r == -1) Then write “ Q Underflow” else Item=Q[f] If f > r F=0,r=-1; else f=f+1 return item Slide 14: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - f r 0 1 2 3 4 Insert Operation Slide 15: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 2 3 4 Insert Operation Slide 16: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 2 3 4 Insert Operation Slide 17: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 4 Insert Operation Slide 18: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 3 Insert Operation Slide 19: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 7 7 7 f r 0 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 4 0 4 4 4 3 4 Q Full Slide 20: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 6 6 6 0 1 0 2 8 8 0 2 8 3 5 5 5 4 4 3 3 3 4 Delete Operation Slide 21: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 8 8 2 8 3 5 5 5 4 4 4 4 3 4 Delete Operation Slide 22: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 5 5 5 4 4 3 3 3 4 Delete Operation Slide 23: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 4 4 4 3 4 Delete Operation Slide 24: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR f r Item Q[r] 0 -1 - - 0 0 f r 1 1 0 1 2 2 3 2 3 3 4 Delete Operation 4 4 5 4 Front > Rear Reinitialize f=0 , r=-1 Slide 25: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Slide 26: Mr. J V Gorabal Asst Prof CSE RLJIT DBPUR Thank U.... JVG