CSE 214 Lecture 4: Queues

14 views4 pages

Document Summary

A queue is a sequence of data elements (of the same type) arranged one after another conceptually. An element can be added to the rear of the queue only (enqueue) An element can be removed from the front of the queue only (dequeue) Telecommunications and transportation engineering: modeling and simulation of computer and phone networks, raod systems and transportaiton hubs. Constructor: create an empty queue isempty: is the queue empty. Enqueue: insert an elment on to the rear of the queue (if the queue is not full) Dequeue: remove the front element from the queue (if the queue is not empty) 9 public class intqueue implements cloneable{ public final int capacity = 100; private int[] data; private int front; private int rear; // intqueue methods public intqueue(){ front = -1; 37 else front = (front + 1) % capacity; 9 public class intqueue implements cloneable{ private intnode front; private intnode rear;

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents