
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:Java Algorithm Programming Question
Implement the ADT queue by using a circular linked list. Recall
that this list has only an external reference to its last note.
Example Output:
Show the output
Create a queue:
isEmpty () returns true
Add to queue to get
Joe Jess Jim Jill Jane Jerry
isEmpty () returns false
Testing getFront and dequeue:
Joe is at the front of the queue.
Joe is removed from the front of the queue.
Jess is at the front of the queue.
Jess is removed from the front of the queue.
Jim is at the front of the queue.
Jim is removed from the front of the queue.
Jill is at the front of the queue.
Jill is removed from the front of the queue.
Jane is at the front of the queue.
Jane is removed from the front of the queue.
Jerry is at the front of the queue.
Jerry is removed from the front of the queue.
The queue should be empty: isEmpty() returns true
Add to queue to get
Joe Jess Jim
Testing clear:
isEmpty() returns true
Add to queue to get
Joe Jess Jim
Joe is at the front of the queue.
Joe is removed from the front of the queue.
Jess is at the front of the queue.
Jess is removed from the front of the queue.
Jim is at the front of the queue.
Jim is removed from the front of the queue.
The queue should be empty: isEmpty() returns true
The next calls will throw an exception.
Exception in thread "main" EmptyQueueException
at CircularlinkedQueue.getFront (CircularLinkedQueue. java:55)
at Driver.testQueueOperations (Driver.java:76)
at Driver.main(Driver.java: 12)
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 3 images

Knowledge Booster
Similar questions
- please complete the following in JAVA Implement the graph ADT using the adjacency list structure. thanks! also posting a similar question for adjacency matrix. have a good day!arrow_forwardTrue or False? When implementing a queue with a linked list, the front of the queue is also the front of the linked list.arrow_forwardJava language NOTE THAT WE ARE USING **LINKED LISTS** SEE PICTURES FOR ALL INFORMATION Solve method public boolean inSort(double elt) { //code goes here } please and thank you!!!!arrow_forward
- Please written by computer source In java please!arrow_forwardImplement a Queue using a vector or the STD ::queue:: class Note the difference in what it takes to implement using a char[] array vs a vector or the STD ::queue:: class The user will input a string and the program will return the string with each letter in the string duplicated. Displaying correct Queue implementation. Utilize the conventional methods as needed. Sample Execution Please input String: happy Program will produce the output string. Only use the enqueue(), dequeue(), empty(), etc hhaappyyarrow_forwardpython help. Write a LikedQueue (code at bottom) Test it by: Add numbers from 13 to 23 in the queue. Print the length of the queue Check if the queue is empty Show the item at the front of the queue Remove the first item in the queue Add 100 to the queue Remove all items in the queue Check if the queue is empty """File: linkedqueue.pyAuthor: Ken Lambert"""from node import Nodefrom abstractcollection import AbstractCollectionclass LinkedQueue(AbstractCollection):"""A link-based queue implementation."""# Constructordef __init__(self, sourceCollection = None):"""Sets the initial state of self, which includes thecontents of sourceCollection, if it's present."""self.front = self.rear = NoneAbstractCollection.__init__(self, sourceCollection)# Accessor methodsdef __iter__(self):"""Supports iteration over a view of self."""passdef peek(self):"""Returns the item at the front of the queue.Precondition: the queue is not empty.Raises: KeyError if the stack is empty."""if self.isEmpty():raise…arrow_forward
- Implement a Single linked list to store a set of Integer numbers (no duplicate) • Instance variable• Constructor• Accessor and Update methods 2.) Define SLinkedList Classa. Instance Variables: # Node head # Node tail # int sizeb. Constructorc. Methods # int getSize() //Return the number of nodes of the list. # boolean isEmpty() //Return true if the list is empty, and false otherwise. # int getFirst() //Return the value of the first node of the list. # int getLast()/ /Return the value of the Last node of the list. # Node getHead()/ /Return the head # setHead(Node h)//Set the head # Node getTail()/ /Return the tail # setTail(Node t)//Set the tail # addFirst(E e) //add a new element to the front of the list # addLast(E e) // add new element to the end of the list # E removeFirst()//Return the value of the first node of the list # display()/ /print out values of all the nodes of the list # Node search(E key)//check if a given…arrow_forwardWrite a program in Python to show how a queue works using empty, size, front, back, push item onto queue, and push item off queue.arrow_forwardJavaarrow_forward
- Implement a circular queue by writing circular.h and circular.c. Here are the contents of circular.h: #define QUEUE_SIZE 100 typedef struct { int head; int tail; int itemCount; int items[QUEUE_SIZE]; } CircularQueue; void CircularInitialize(CircularQueue * q); void CircularEnqueue (CircularQueue * q, int value); int Circular Dequeue (CircularQueue * q, int *pValue); Using an array, implement a circular queue of up to 100 elements of type integer. Implement the functions CircularEnqueue() and Circular Dequeue () to place numbers in the head of the queue and read them from the tail of the queue tail. A circular queue only saves the last n entries (where n is the number of elements in the queue). Overwrite the oldest entries with newest entries once the queue is full.arrow_forwardQuestion v .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forwardWith the concepts of Queue Data Structure, write the functions performing the following tasks: 1. Insertion of an element in the Queue i.e. enqueue() 2. Deletion of an Element from the Queue i.e. dequeue() 3. Display All Elements in the Queue i.e. dispqueue() 4. Display the Element at the Front i.e. dispfront() 5. enqueue() the Queue with the elements in ascending order. After that, use the above four functions to display the same elements in the Queue in descending order.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY