Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CCCS 3 1 5 : Data Structures and Algorithms Assignment 3 Type of Assignment Individual Work Estimated Time: 1 6 0 minute Description In this
CCCS : Data Structures and Algorithms
Assignment
Type of Assignment
Individual Work
Estimated Time: minute
Description
In this Assignment, you will examine the Priority Queue libraries to solve a business problem as well
as implement and analyze a variation of the heap data structure.
Learning Outcomes
Recognize the use of the Priority Queue and Heap datastructures
Apply BigO notation to analysis of an algorithm
Evaluation
Points
Code formatting and citations
Part Implement a stack using the sorted priority queue
Part : Implement a queue using a priority queue
Part : Implementation and Analysis of a FourHeap
Total
Submitting your work
Work is to be submitted through MyCourses. Please validate that your ZIP files contain both java and
class files prior to submitting. Submissions lacking source code cannot and will not be marked.
Part : Implement a stack using a priority queue
Objective
Using the skeleton class SortedPriorityQueueStack provided, implement a stack abstract data type
using only a sorted priority queue and one additional integer instance variable. Analyze the BigO
runtime of your implementation of the push and pop methods.
Requirements
Your solution should use the textbook net.datastructures.SortedPriorityQueue
Skeleton classes and JUnit test cases are provided to support your implementation. These
skeletons should be implemented however additional methods may be required.
Implement proper error handling
The BigO runtime of the push and pop should be indicated in the code comments
Points
Points Method
public SortedPriorityQueueStack constructor and body
public void pushV value
point for BigO analysis
public V pop
point for BigO analysis
public V top
public int size
public boolean isEmpty
Total
Part : Implement a queue using a priority queue
Objective
Using the skeleton class UnSortedPriorityQueueQueue provided, implement a queue abstract data
type using only an unsorted priority queue and one additional integer instance variable. Analyze the BigO runtime of your implementation of the enqueue and dequeue methods.
Requirements
Your solution should use the textbook net.datastructures.UnSortedPriorityQueue
Skeleton classes and JUnit test cases are provided to support your implementation. These
skeletons should be implemented however additional methods may be required.
Implement proper error handling
The BigO runtime of the enqueue and dequeue should be indicated in the code comments
Points
Points Method
public UnSortedPriorityQueueQueue constructor and body
public void enqueueV value
point for BigO analysis
public V dequeue
point for BigO analysis
public V first
public int size
public boolean isEmpty
Total
Part : Implementation and Analysis of a FourHeap
This question is inspired from the University of Washingtons cse
Objective
The goal of this part of the assignment is to analyze a generic, four minheap. A four minheap is similar
to a binary minheap but each node can have up to four child nodes. In your analysis, you will assume
that the FourHeap implements the generic PriorityQueue interface and maintain both the heap
structure and the minimum heap order property. We will also assume that your FourHeap uses an array
like we have for net.datastructures.HeapPriorityQueue. However, the computations to find the
index of a node's children and parent will be different.
Please answer the following questions and submit in a text document, aqtxt
Given the arraybased implementation of the fourheap, please implement the following
methods using inspiration from net.datastructures.HeapPriorityQueue:
protected int parentint j
protected int leftint j
protected int rightint j
On inserts, do you expect net.datastructures.HeapPriorityQueue or FourHeap to
perform better? Explain why.
On remove, do you expect net.datastructures.HeapPriorityQueue or FourHeap to
perform better? Explain why.
Be aware that I am providing a full skeleton to help in your comprehension of the fourheap. A full
solution of this skeleton does not need to be returned.
Requirements
Answers and justification to this parts questions should be present in file aqtxt
Points
Points Method
protected int parentint j
protected int leftint j
protected int rightint j
Analysis of insert performance of fourheap vs binary heap.
Analysis of removeMin perfoance of fourheap vs binary heap.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started