Sunday, March 6, 2011

DS-operations on queue.

Operations:
The main primitive operations of a queue are known as:
Add - adds a new node
Remove - removes a node
Additional primitives can be defined:
IsEmpty - reports whether the queueis empty
IsFull - reports whether the queue is full
Initialise - creates/initialises the queue
Destroy - deletes the contents of the queue (may be implemented by re-initialising
the queue)

Common operations from the C++ Standard Template Library include the following:
bool empty() - Returns True if the queue is empty, and False otherwise.
T& front() - Returns a reference to the value at the front of a non-empty queue. There is also a constant version of this function, const T& front().
void pop() - Removes the item at the front of a non-empty queue.
void push(const T& foo) - Inserts the argument foo at the back of the queue.
size_type size() - Returns the total number of elements in the queue.
 
 
Some other Operations on queue are :
1. enqueue - insert item at the back of queue 
2. dequeue - return (and virtually remove) the front item from queue 
3. init - intialize queue , reset all variables.

refer : http://en.wikipedia.org/wiki/Queue_%28data_structure%29
          http://harvestsoft.net/files/queue.pdf
          http://hamilton.bell.ac.uk/swdev2/notes/notes_13.pdf

No comments:

Post a Comment