Amazon Interview Question
Software Engineer / DevelopersCountry: United States
1. They are difficult to create, maintain and manipulate as many of them are implemented using pointers.
2. They do not provide sequential access, this maybe advantageous in some algorithms but in others it is a disaster.
3. non linear data structure takes up more memory as compared to linear data structure. This is mainly because non-linear ds requires pointers or adjacency matrix or some other technique to logically represent it.
It is a simple FIFO data structure.
- luckless March 20, 2012The main advantages is that adding or removing elements can be done quickly and efficiently because you would just add elements to the end of the queue or remove them from the front of the queue.
The main disadvantages is that a queue is not readily searchable (sure there are hacks around it but it is not supposed to be searchable) and adding or removing elements from the middle of the queue is very complex (again it is not MEANT to allow elements to be removed from the middle).