
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
For Java.

Transcribed Image Text:Implement a priority queue using java.util.Stack as the base data type.
Your code must not reference java.util. PriorityQueue!
You may need several Java classes for this: one to define Entry, one for the priority
queue, and one for the main program. It's acceptable to use inner classes if you'd rather
have everything contained in one .java file.
Feel free to reuse code from the sample files, on-line sources, this lab, and/or the
textbook. Please cite any code found on-line.
Your priority queue must implement the following methods:
insert (Entry E)
removeMin ()
Where Entry is: int k; String v;
The core data storage should be: Stack<Entry> s;
Hint: you may need more than one stack to fully implement the queue!
The following test cases should be hard-coded into your program:
Input (in order)
(3,"test")
(4,"every")
(5, "edge")
(10,"smoked")
(5, "quality")
(12,"beef")
(1, "good")
(9,"or")
(3, "to")
(5, "be")
(10,"not")
- inserts a new node E in the priority queue
- returns the entry with the lowest key value
Output (in order)
(3, "test")
(4,"every")
(5, "edge")
(1, "good")
(5, "quality")
(10,"smoked")
(12,"beef")
(3, "to")
(5, "be")
(9,"or")
(10,"not")
I am not picky about output formatting, but the data must come from the priority
queue.
The program must work for any correct sequence of entries, not just the test cases.
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 4 steps with 2 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
- In what ways do coding standards matter? In this analysis, we will look at the Java programming language's coding standards.arrow_forwardDescribe the role of InputStreams in handling network communication in Java.arrow_forwardCould I get this code explained to me in java. I have the general grasp but would love to have it explained in a language im more famaliar with.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