
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
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:
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 fron the front of the queue.
The queue shou ld be empty: isEmpty() returns true
The next calls will thraw an exception.
Exception in thread "main" EmptyQueueException
at CircularLinkedQueue.getFront(CircularLinkedQueue.java:55)
at Driver.testQueue0perations(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.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) System.out. println("Positive."); else System.out.println("Non-positive, converting to 1."); userNum = 1; + userNum); %3D System.out.println("Final: Common student error: Changing the order of the lines. You only need to fix the existing code. 2 3 public class ConvertNegative { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int userNum; 4 7 8 userNum = scnr.nextInt(); 9. if (userNum > 0) System.out.println("Positive."); 10 11 12 else 13 System.out.println("Non-positive, converting to 1."); userNum = 14 1; 15 16 System.out.println("Final: + userNum); 17 18 } 19 }arrow_forwardWrite a java program class for a singly linked list with Insertion from head, tail and middlearrow_forwardNote: javaarrow_forward
- Implement MSD string sorting using queues, as follows: Keep onequeue for each bin. On a first pass through the items to be sorted, insert each item intothe appropriate queue, according to its leading character value. Then, sort the sublistsand stitch together all the queues to make a sorted whole. Note that this method doesnot involve keeping the count[] arrays within the recursive method.arrow_forwardQ3 QuickSort Given the QuickSort implementation from class, provide an 18-element list that will take the least number of recursive calls of QuickSort to complete. As a counter-example, here is a list that will cause QuickSort to make the MOST number of recursive calls: public static List input() { return Accaxsaslist(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } wwwwwww And here's the QuickSort algorithm, for convenience: algorithm QuickSart Input: lists of integers 1st of size N Output: new list with the elements of lat in sorted order if N < 2 return st pivot Jat[N-1] left = new empty list right = new empty list for index = 0, 1, 2, if lst[i]<= pivot left.add(lat[i]) = else N-2 right add(lat[i]) return QuickSort(left) + [pivot] + QuickSort (right)arrow_forwardThe circular array queue implementation increased the dequeue operation's performance from O(n) to O(1) by doing away with the requirement to move array items. Adding or removing members from a list can occur anywhere along its length, not simply at the front or back, thus this is not true.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education