1. Member
Join Date
Apr 2009
Posts
11
Rep Power
0

hey im new to the site =) but i just had a question that i asked one of my teachers aid's in class and they wern't able to assist me, i was hoping someone on here might have a better understanding.

we've been talking about queue's in class, and to my understanding a linked list works great just because of how it is structured. but what about an array? i mean yeah an array itself seems like a not so logical way to go about a queue. i read that circular arrays can work just as well.. are there times when you should use a circular array queue over a linked list queue? what is the real difference between the two?? what i was thinking is that it would be easier to find a specific "thing" in a circular array queue acting like a "priority queue" if that makes sense.

2. Senior Member
Join Date
Sep 2008
Posts
564
Rep Power
9
the difference between a queue using a circular array and linked list is the same as just using an array vs a linked list in most situations, really.

also, a priority queue doesn't work with a single array or list. depending on its actual specs, it can be composed of 2 or more queues, one for each level of priority. sure, you can define one where it uses a single list, but it would be inefficient to have to iterate through it, as opposed to taking advantage of a queue being fifo.

3. Member
Join Date
Apr 2009
Posts
11
Rep Power
0
true but, if you arrange the array in a circular fashion can't you make it so instead of iterating through everything you can just change what index denotes the head and the tail of the queue??

ex.

array has object at index 1-5;
queue is identified for objects 1-5:

object 1 is removed from queue;
queue is redifined;

array has object at index 1-5;
queue is identified for objects 2-5;

thats kinda what was going through my head....
Last edited by sick_peng; 04-15-2009 at 06:42 PM.

4. Senior Member
Join Date
Sep 2008
Posts
564
Rep Power
9
are you still talking about a priority queue?

5. Member
Join Date
Apr 2009
Posts
11
Rep Power
0
no a priority queue was just something that i thought that maybe an array could be used over a linked list. my question is... is there "ANY" reason or situation where a circular array would be more useful thank a linked list used in any type of queue
Last edited by sick_peng; 04-15-2009 at 07:15 PM.

6. Senior Member
Join Date
Sep 2008
Posts
564
Rep Power
9
and to that i replied that the dis/advantages of each are similar to general uses of arrays and linked lists. unless you're implying that there is no reason to ever use an array.

7. Member
Join Date
Apr 2009
Posts
11
Rep Power
0
aight naw i was just curious guess idk what kind of an answer im looking for haha.. anyway thanks for replying man.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•