Solved

queue's

Posted on 2002-04-04
3
289 Views
Last Modified: 2010-03-31
i would like to know what are are the advantages and disadvantages of

Queues implemented as an array
Queues implemented with nodes and pointers


i am a newbie so please explain a bit and examples would be great!

thank you for your help!!!

steven
0
Comment
Question by:stevenglass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:m_onkey_boy
ID: 6919926
A queue implemented with an array has a pre-defined length and this cannot be changed without allocating a whole new array and copying the contents of the original, where a queue implemented with nodes and pointers will grow/shrink as needed.

Java doesn't use the concept of a pointer, though - at least not explicitly.

If you use an array, simply use an array.  If you wnat to use the node/pointer approach use java.util.LinkedList as you underlying data structure.
0
 

Accepted Solution

by:
SreedharSanni earned 75 total points
ID: 6920607
Though Queue can be implemented using arrays and pointers,
the implementation type depends on the necessity...
if we know the max size of the queue, it is better we can go with Arrays as handling of arrays is easy.

But when we dont know the size of queue..arrays dont suffice our need so we go for dynamic memory allocation and linking those objects ..which we implement it with Nodes and pointers(in C/C++).

And Java do not have any pointers, it has support for datastructures like java.util.LinkedList etc which will help us in implementating this.

Cheers...
Sreedhar Kumar
0
 
LVL 4

Expert Comment

by:m_onkey_boy
ID: 6921321
echo?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question