?
Solved

queue's

Posted on 2002-04-04
3
Medium Priority
?
293 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 300 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

752 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