I've been thinking of implementing a Queue and a Stack data structure using either an Array / LinkedList (single /Double). Any one has any thoughts on which one might be a better choice. A reasoning would be great too.
Array - Pro: You can access the whole stack or queue whenever you want.
Con: You can only have a fixed size. The size you originally declare it with.
LinkedList - Pro: you can have unlimited size, at least until your memory runs out.
Con: You have to search through the entire list to find something, because each part of the list (node) only knows where the next node is; it can't see the entire list.
Both have good uses. Which one you choose depends on what you need your program to do.
"If the facts don't fit the theory, get new facts" --Albert Einstein
Joined: Oct 13, 2005
Nothing wrong with the existing Stack for general use, apart from the design problem that it extends Vector.
The fastest Stack and Queue implementation is probably ArrayDeque .