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

Define the key weakness of the web, Define the key weakness of the web? ...

Define the key weakness of the web? the key weakness of the web is Initially web was designed only for humans to read not for computers to understand it.

Fibonacci, Output first x values in the fibonacci sequence, where x is an a...

Output first x values in the fibonacci sequence, where x is an argument to the program. 0, 1, 1, 2, 3, 5, 8, ... Write the fibonacci creation function separate from the main func

Java application to simulate a bank system, Write a Java application to sim...

Write a Java application to simulate a bank system. In the system, customers can open new bank accounts with the bank, and register/use an online account to manage their bank accou

List the java class library, list The Java Class Library? Java holds an...

list The Java Class Library? Java holds an extensive library of pre-written classes you can use in your programs. These classes are separated into groups known as packages. Th

Bluej program, program to find the frequency of a digit in a number

program to find the frequency of a digit in a number

Explain ftp-telnet-voip and instant messaging, Write a brief note on each o...

Write a brief note on each of the following. FTP Telnet Instant messaging VoIP FTP: File Transfer Protocol: This protocol is used to upload and download the

Write a program calculates the resistance of group resistors, The formula f...

The formula for resistors linked in parallel is a little more complex. Given two resistors along with resistances R1 and R2 linked in parallel the equivalent resistance is given th

Develop a geonetwork template, Develop a GeoNetwork Template Project Des...

Develop a GeoNetwork Template Project Description: Want a personalized GeoNetwork Template with the consideration of the logo included to this proposal and its colors. The ba

Corporate web support, Corporate Web Support: Worked for CGI as Sof...

Corporate Web Support: Worked for CGI as Software Engineer in a team called CWS (Corporate Web Support). We support more than 400 applications for BELL Corporate. Here tas

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