Implement queues - linked list, JAVA Programming

Assignment Help:

Implement Queues / Linked List

Project Description:

In this project, two kinds of queue are implemented: LinkedQueue implements FIFOQueueInterface { .... } and LLQueueItr implements Iterable, FIFOQueueInterface { ... }. Note that FIFOQueueInterface should be described before the two queues are implemented.

Public interface FIFOQueueInterface

{

boolean isEmpty();

void enqueue(T item);

T dequeue();

}

Two queues should implement those three methods, isEmpty(), dequeue() and enqueue(). Both have inner class Node which has data and next with the constructor.

LinkedQueue.java will be defined as follows. The blanks should be filled.

Now, consider LLQueueItr.java. It implements both FIFOQueue and Iterable. The interface FIFOQueue is the same as described above, and the interface Iterable is givenby jdk (java.lang.Iterable). It turns out that LLQueueItr should implements all methods from the both interfaces. The method isEmpty(), enqueue() and dequeue() are defined same as in the class LinkedQueue. In addition to that, according to the API of Iterable, the method, iterator() should be implemented. The API says the method iterator() return an object of Iterator. Iterator is an interface in jdk (java.util.Iterator), and it has three methods, hasNext(), next() and remove(), which should also be implemented.

As a driver program invokes the method, iterator(), which returns an object in Iterator, it will use the returned object to invoke the methods of Iterator class. For example, hasNext() method is used to check if the next node of queue is available. If so, the method next() will return the content of that node and move to the next node. To make this possible, those methods should be implemented in the LLQueueItr class.

Skills required: Java


Related Discussions:- Implement queues - linked list

List down the names of two array techniques available java, List down the n...

List down the names of two array techniques available in JavaScript. The two techniques thata rae available in java script is: 1. sort( ) [sorts elements within alphabetical

Write code in javascript language to show the odd numbers, Write code in Ja...

Write code in JavaScript language to show the odd numbers among 20 to 100 using FOR statement. Note: No requirement to write whole HTML program. Just JavaScript code of need p

Explain the 4 phases of RUP?, 1. Inception : In the mean while the inc...

1. Inception : In the mean while the inception phase, you work out the business part for the project. You also will be creating a rough cost estimate and return on investment.

What is a portal?, A portal is a service or a Web site that gives broad ran...

A portal is a service or a Web site that gives broad range of services and resources like e-mail, forums, search engines, weather information, news, on-line shopping, stock quotes.

Program to brute force search, Ask questionWrite a program BruteForceSearch...

Ask questionWrite a program BruteForceSearch that uses the brute-force approach given above and compare its running time on your computer with that of Binary Search for largeW.txt

Simple functional website without any graphic work, Want simple functional ...

Want simple functional website without any graphic work, like panel Project Description: I want a very simple look website .It should be like a panel. Few tab, contact form,

For statement in javascript, A for loop repeats until a specified condition...

A for loop repeats until a specified condition evaluates to false. For for loop the JavaScript is similar to the Java and C for loops. A for statement looks as:  for ([initial-

Explain function system.arraycopy(), Explain function system.arraycopy() ? ...

Explain function system.arraycopy() ? Although copying an array isn't particularly hard, it is an operation that advantages from a native implementation. Thus java.lang.System

Mention five applications of artificial intelligent system, Mention any fiv...

Mention any five applications of Artificial Intelligent System? 1)Medical Diagnosis 2)Robots 3) Games 4) Business intelligence 5)Image Recognition.

What is a framework, A framework is made up of the set of classes which per...

A framework is made up of the set of classes which permit us to use a library in a best possible way for a particular requirement.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd