Western Illinois University cs 351
Homework #3 CS 351.001 Spring 2024 Data Structure II 50 Points Due: 03/28/2024, 11:59 PM Read the instructions carefully. Points will be deducted if programs are not written based on the instructions. 1. Write a program in Java to implement the max-priority queue using the max-heap data structure. Implement the max-heap data structure using an integer array of 5 cells. (Do not use Java built-in PriorityQueue class.) [In a max-heap, the root node and the intermediate node values are always greater than their children.] First, insert 5 integer values from the user in the max-priority queue. Then print the elements of the queue. After that, delete two elements from the queue and print them. You can implement the Priority Queue pseudo code discussed by me in class, which is available on Western Online. The sample inputs/ outputs are given below: (25 Points) Sample inputs and outputs: (User’s inputs are shown in bold) Enter 5 values: 5 15 7 9 20 The elements of the max-priority queue: 20 15 7 5 9 The element removed after the first deletion: 20 The element removed after the second deletion: 15 2. Write a program in Java to implement a hash table of size 11 using the hash function h(x) = (3x + 5) mod 11, where x is an integer element that represents the key. Insert the key elements only in the hash table (do not consider any value associated with the key). In the next phase, implement the linear probing to handle collision. Your program should print the hash table after inserting each element and ask whether the user wants to continue. (25 Points) Upload the two .java files on the Western Online Homework 3 page.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
