Solved

Java

Posted on 2006-11-03
2
230 Views
Last Modified: 2010-04-16
How do you create a Java Implementing a Queue with a  Singly Linked  List?
0
Comment
Question by:deliachang
2 Comments
 
LVL 4

Expert Comment

by:hclgroup
ID: 17869679
Where is your attempt?
What problems are you encountering?
0
 
LVL 10

Accepted Solution

by:
NetworkArchitek earned 500 total points
ID: 17869739
Create a Node class then create your Queue class and make it use a LinkedList of Nodes.

A queue has two important operations: enqueue and dequeue. Remember, a Queue works as a FIFO store, First-In-First-Out.

This sounds like homework though so you should try to work through it. It's pretty simple. Remember, in a LinkedList the Node will have 2 data members a Node representing the next node and the actual data object.  Your LinkedList will need to maintain a refernce to the "head" of the list.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

735 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