4 Easy Quiz Questions
Question 1:
Below are the contents of the id array for the quick-find
version of the Union-Find algorithm.
0,4,7,0,4,4,4,7,8,0
The contents are listed in order from slot 0 to slot 9. (So for
example, id[1] is 4 and id[2] is 7.
What are the contents of the id array after the call union(5,
3)?
Use the same format as above (a comma-separated listing of the
contents without spaces).
_____________________
Question 2
Below are the contents of the id array and the size array for the
weighted quick-union version of the Union-Find algorithm.
id: 0,4,7,0,4,4,5,7,8,0
size: 3,1,1,1,4,2,1,2,1,1
The contents are listed in order from slot 0 to slot 9. (So for
example, id[1] is 4 and id[2] is 7 and size[0] is 3.
What are the contents of the id array after the call union(5,
3)?
Use the same format as above (a comma-separated listing of the
contents without any spaces).
_____________________
Question 3 (25 points)
Below are the contents of pq [] that stores the items in a heap for
a max priority queue. (There are currently 9 items in the priority
queue, but the array itself is bigger)
-,100,19,36,17,3,25,1,2,7
The items are listed in the order they appear in the array.
Remember that slot 0 of the array is not used.
List out the contents of the heap (the first 11 slots in the pq
array, including the - for slot 0) after inserting 27. List out the
contents in the same format as above, a comma-separated list of
numbers (except for a - in slot 0) with no spaces.
_____________________
Question 4
Below are the contents of pq array that stores the items in a heap
for a max priority queue. (There are currently 9 items in the
priority queue, but the array itself is bigger)
-,100,19,36,17,3,25,1,2,7
The items are listed in the order they appear in the array.
Remember that slot 0 of the array is not used.
List out the contents of the heap (the first 9 slots in the pq
array, including the - for slot 0) after deleteMax is called. List
out the contents in the same format as above, a comma-separated
list of numbers (except for a - in slot 0) with no spaces.
_____________________
It seem like only answer was required but i have given solution hope it helps


answer 2 -> id: 5,4,7,0,4,4,5,7,8,0


answer 4 -> 36 | 19 | 25 | 17 | 3 | 7 | 1 | 2
Please comment for any further clarifications.
4 Easy Quiz Questions Question 1: Below are the contents of the id array for the...
Need help with the trickle down This is the maxheap.h #ifndef MAXHEAP_H_INCLUDED #define MAXHEAP_H_INCLUDED #include <vector> #include <sstream> #include <string> #include <queue> #include <cmath> // pow() using namespace std; #define PARENT(i) ((i-1) / 2) #define LINE_WIDTH 60.0 template<class T> class MaxHeap{ // private: vector<T> heap; void bubbleUp(int id); void Heapify() { int length = heap.size(); for(int i=length / 2 -1; i>=0; --i) trickleDown(i); }; public: MaxHeap( vector<T> &vector ) : heap(vector) { Heapify(); } ; MaxHeap() {}; void trickleDown(int...
PROGRAM DESCRIPTION Using the given class definitions for either C++, create a minimum heap that stores integers and and implements a minimum priority queue. (Your program can be "hard coded" for integers - it does not need to use templates, generics, or polymorphism.) Your data structure must always store its internal data as a heap. Your toString function should return a string with the heap values as a comma separated list, also including the size of the heap as well....
Region Country Item Type Sales Channel Order Priority Order Date Order ID Ship Date Units Sold Unit Price Unit Cost Total Revenue Total Cost Total Profit Asia Morocco Clothes Online M ######## 6.68E+08 ######## 4611 109.28 35.84 503890.1 165258.2 338631.8 Sub-Saharan Africa Ghana Office Supplies Online L ######## 6.01E+08 ######## 896 651.21 524.96 583484.2 470364.2 113120 Sub-Saharan Africa Slovakia Beverages Offline L ######## 1.75E+08 ######## 3973 47.45 31.79 188518.9 126301.7 62217.18 For this assignment you have been engaged by an...
I NEED HELP WITH THIS HOMEWORK!!!! What is a characteristic of a bag data type? Elements are added and removed in any order Elements are removed in the same order they were added Distinct elements are added in any order but are removed beginning with the last one added Distinct elements are removed in the reverse order they were added Which scenario illustrates a data stack structure Standing in a line to be serviced Filing documents in alphabetical order Offering...
Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....
Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....
A priority queue is a collection of items each having a priority. A priority queue supports three fundamental operations. You can ask a priority queue whether it is empty. You can insert an item into the priority queue with a given priority. You can remove the item from the priority queue that has the smallest priority. For example, suppose that you start with an empty priority queue and imagine performing the following steps. Insert item "one" with priority 10. Insert...
Can you please help with the below? 1) Which of the following is true about using a 2-3-4 tree? a. It is designed to minimize node visits while keeping to an O(log n) search performance b. It is designed to self-balance as new values are inserted into the tree c. As soon as a node becomes full, it performs the split routine d. None of the above 2) Which of the following is true about a binary search tree? a. ...
DatabaseFilter Design a DatabaseFilter class that will manage the file 1/O (input/output) of an employee ArrayList object. For a Database Filter class to actually store an ArrayList object, it must know the file to which the list must be read from or written to. Note: It is expected that you may have more methods within your class design than requested in the specifications described below. However, your class should support at a minimum the following data and operations: encapsulated data...
JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...