javamate06
asked on
Queues Implementation
How to implement queues in C, can we do it as array or is there a built in way to do it?
If there is, what about pop and push methods?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi,
You can Impliment in two ways,
1. Linear implimentation
2.Circular Implimetation
These two also you can impliment through Arrays or Linked List.
Refer the following URL you will get an idea abt the implimentation
http://www.c.happycodings.com/Data_Structures/code16.html
http://www.wol.net.pk/mtshome/cppDataStructures.html
Deepu
You can Impliment in two ways,
1. Linear implimentation
2.Circular Implimetation
These two also you can impliment through Arrays or Linked List.
Refer the following URL you will get an idea abt the implimentation
http://www.c.happycodings.com/Data_Structures/code16.html
http://www.wol.net.pk/mtshome/cppDataStructures.html
Deepu
The implementation is the same as that of a linked list except that adding (pushing) always adds to the tail and removing (popping) always removes from the head. There are pros and cons as to whether a singly linked list or a doubly linked list is faster. I normally use a doubly linked list as I tend to traverse both ways.
You may also see something called a dequeue: a double ended queue. This is quite a strange one: you can add to both the head and tail and remove from both the head and tail.
You may also see something called a dequeue: a double ended queue. This is quite a strange one: you can add to both the head and tail and remove from both the head and tail.
You can find an implementation of Queues in glib. See e.g.
http://developer.gnome.org/doc/API/2.0/glib/glib-Double-ended-Queues.html
Regards
Friedrich
http://developer.gnome.org/doc/API/2.0/glib/glib-Double-ended-Queues.html
Regards
Friedrich
If you can use C++ there is some stuff in the template library that would help.