Heaps Code
Q: Maintenance Making sure that there is enough financial, support and facilities for the students to…
A: Introduction What is the software development life cycle, and why does this idea initially seem so…
Q: I need help converting these entities into SQL Tables. Strong Entity (9) customer(customerID,…
A: Program Approach:- First need to create all tables with below queries and after creating table…
Q: 5. Suppose a user wishes to edit the file xyzzy in a capability-based system. How the editor cannot…
A: The solution to the given question is: In a feature-based system , permissions are set on files for…
Q: Algorithm Binary Search Input: L = a1, a2, ... , an list of distinct integers; x integer Output:…
A: Binary Search:- By periodically halving the search interval, the binary search algorithm finds items…
Q: 53, VBST constructs a spanning tree in each VLAN so that traffic from different VLANs is load…
A: VBST corresponds to STP or RSTP running on each VLAN. Spanning trees in different VLANs are…
Q: 2. to both, Alice and Bob have a common factor. Alice and Bob are creating RSA public keys. They…
A: Private key A private key is a secret number, similar to a password, that is used in cryptography.…
Q: Computer A tries to send 6 frames to computer B. The second frame does not arrive correctly (assumed…
A: Solution- Wait for Frame 0 if Rn = 0, which indicates that Frame 0 is the anticipated next frame.…
Q: Write a C++ program to take input a string str and a character ch the character ch in the string…
A: here we have To find the frequency of the character ch in the string str, initialize an integer…
Q: If a primary route fails on the network, the floating static route will be added to the routing…
A: Introduction The process of choosing a path for traffic within, between, or across networks is…
Q: Regarding the deep belief network, can it better control the “chance-driven” error of restricted…
A: Boltzmann machine The locality, Hebbian nature, parallelism, and likeness of Boltzmann machines'…
Q: 32. Which of the following IP addresses can be allocated to hosts? A. 192.168.100.255/22 B.…
A: An IP address or Internet Protocol address is a series of numbers that identify each device on a…
Q: 52. When a DHCP client applies for an IP address, only DHCP ACK messages are sent in unicast mode. @
A: DHCP Client:- A DHCP client is an Internet host that uses DHCP to get configuration information,…
Q: List the pros and cons of emotional artificial intelligence (ai) applications in a table or diagram…
A: The answer to the question is given below:
Q: Need ASAP. Create a Java Program to convert an input integer from 1-3000 in words and also Section:…
A: JAVA HISTROY:- It's fascinating to learn about Java's past. Java was initially intended for…
Q: Write a Java program that opens a file and counts the whitespace-separated words in that file. You…
A: Introduction Since practically all text boxes that rely on user input have restrictions on the…
Q: Exercise 1 Use the function design recipe to develop a function named add_up that takes one…
A: Step-1: StartStep-2: function add_up(n) Step-2.1: Declare variable a=0, sum=0Step-2.2: Start a…
Q: Given a function uint16_t func(int16_t x) write a function callPassed Func() that takes two…
A: Here is the c program of the above problem. See below steps.
Q: Write the signature of a method named send that has one parameter of type String, and does not…
A: Given: The send method has one parameter of type String and the return type is void. To find: Â The…
Q: these are the options, 1.Line 20 2.Line 10 and Line 16 3.Line 17 4.Line 17 and 21
A: Given program: // Implementation file for the Rectangle class.1. #include "Rectangle.h" // Needed…
Q: 1. Suppose the input array is A = A. At the end of the first iteration of the while loop of Line 4,…
A: Introduction Array is given: <10,19,9,7,12,8,5,4,11,2,6,3>, will be passed into the given code…
Q: Algorithm This algorithm is a two step process.First we create a auxiliary array lps[] and then use…
A: The JAVA code is given below with code and output screenshot Happy to help you ?
Q: List some common Computer Specifications that you need to consider in purchasing RAM? Assume heavy…
A: Answer:
Q: Specification Functional Dependency Consider the relational schemas given below and the respective…
A: 2NF (second normal form) When a relation is in First Normal Form and every attribute other than the…
Q: Create a java program to compute the area and perimeter of a rectangle given the length and width…
A: Algorithms Step1: we have taken input from length of the rectangle Step2: and also have taken from…
Q: the integer logb of a number. Where logb returns the integer log of a number in a designated base.…
A: We are asked to write a program that uses a recursive call to find the integer logb of a number.…
Q: How operating system performs program management draw a diagram and write at least 25 activities?…
A: Operating system performs program management.
Q: What data type (Array, List, Tuple, or String) is the following object? [1e-10,(1,2),"BGP",[3]]…
A: Array - a collection of homogenous elements but given object has 4 different types List - a…
Q: # See the table and answer the question use Python language: Name Dr. ISA Dr. Mohd Dr. Ali Dr. Mousa…
A: The python program is given below:
Q: Compute Freeman's Centralization of degree centrality for the following 4-Vertex graph using these…
A: DistanceBwPoint { public static void main(String args[]) { int x1,x2,y1,y2; double dis;…
Q: A secure email system is expected to provide confidentiality, sender's non-repudiation, and message…
A: Encryption: To prevent unwanted parties from reading a message, a readable message is transformed…
Q: 3. Write recursive functions for the following equations: a. Harmonic number is defined by the…
A: As the programming language is not mentioned here, we are using JAVA The JAVA code is given below…
Q: a. Assign the values 9 and 14 to variables a and b respectively. b. Print the binary values of a and…
A: The python program is given below:
Q: Regarding deep learning and long short term memory in recurrent neural networks do they use two…
A: let us see the answer:- Introduction:- Recurrent neural networks are a type of long short-term…
Q: the answer would then be no? they only calculate unsupervised?
A: This is very simple. NO. The answer provided previously is completely Wrong. The correct answer is…
Q: Let A, B, and C be sets, and let X = AU B. (a) Write Ix n c in terms of IAN CI, IBN C, and AnBn Cl.…
A: Venn diagram: Venn diagram is used to show the logical relationship between the sets. Set means a…
Q: In a linear linked list.. a. the next pointer of each node has the value NULL b. the last node…
A: Linear linked list is a linear data structure. It is a collection of nodes . each node consists of…
Q: Algorithm 2.3: Graph depth-first search with a stack. StackDFS (G, node) → visited Input: G=(V, E),…
A: dfs-stack.py in python: # function to push a node to stack S def Push(S,node):…
Q: Question 1) Consider the following DFA M (next page). Minimize DFA M. Draw the table show all your…
A: The correct answer for the above mentioned question is given in the following steps for your…
Q: You'll need to use some of the string methods that we covered in this lesson You can test your…
A: The above question is solved in step 2 :-
Q: Which of the following statements is/are true, for arbitrarily large values of n? (Check all that…
A: Given: We have to choose which of the following options is/are for arbitrarily large values of n.…
Q: Algorithm This algorithm is a two step process.First we create a auxiliary array lps[] and then use…
A: Java Implementaion is given in next step for algorithm:
Q: Maintenance Making sure that there is enough financial, support and facilities for the students to…
A: Software Development Life Cycle(SDLC): Phases of SDLC- Planning Analysis Design Implementation…
Q: Dan’s recently announced that he’s teaching n top-secret courses next semester. Instead of enrolling…
A: #Check if name matches any name in list def checkIfNameExists(name,nameList):…
Q: Which function does the PRIMARY KEY clause perform in table creation? It ensures that’s non-NULL…
A: Answers:- The primary key constraint is a uniquely identifies each record in the table. The Primary…
Q: Create Java Program to convert an input integer from 1-3000 in words and also convert the inputted…
A: The answer is given below.
Q: hoe can information risk be reduce
A: The answer is given below step.
Q: 7. Which type of address is indicated by the IP address 10.0.10.63 and subnet mask 255.255.255.224?…
A: IP stand for internet protocol.
Q: Please create a short program that will list the total directories that are found within /etc/ along…
A: The above question is solved in step 2 :-
Q: Exercise 2 (MAC schemes derived from block ciphers( Let E denote the family of encryption functions…
A: we assume that it is not collision resistant, i.e. we can find a pair of messages x and y where xty…
Q: Suppose a user wishes to edit the file xyzzy in a capability-based system. How can he be sure that…
A: Suppose a user wishes to edit the file xyzy in a Capability based system. How can he be sure that…
Step by step
Solved in 2 steps with 8 images
- 2.2.14 Merging sorted queues. Develop a static method that takes two queues of sorteditems as arguments and returns a queue that results from merging the queues intosorted order.2.2.15 Bottom-up queue mergesort. Develop a bottom-up mergesort implementationbased on the following approach: Given N items, create N queues, each containing oneof the items. Create a queue of the N queues. Then repeatedly apply the merging operation of Exercise 2.2.14 to the first two queues and reinsert the merged queue at the end.Repeat until the queue of queues contains only one queue.2- Implement a class template MinHeap that has the following declaration using c++ class MinHeap{ Node* heap; //an array of nodes int _size; //size of arraypublic: Node extractMin(); //returns & removes the node with minimum cost void buildMinHeap(Node[],int);// allocates array then builds a min-heap from an array of struct Node with the given size void minHeapify(int i, int n);//restores the min-heap property for the “heap” array using the given index and size n void decreaseKey(char label,int newCost);//decreases the node that has the given label to newCost int parent(int i);//returns the index of the parent of i int getSize();//returns size of the heap bool inHeap(char);//checks if the node with the given label is in the heap};(Java) In this task, a skip list data structure should be implemented. You can follow the followinginstructions:- Implement the class NodeSkipList with two components, namely key node and arrayof successors. You can also add a constructor, but you do not need to add anymethod.- In the class SkipList implement a constructor SkipList(long maxNodes). The parameter maxNodes determines the maximal number of nodes that can be added to askip list. Using this parameter we can determine the maximal height of a node, thatis, the maximal length of the array of successors. As the maximal height of a nodeit is usually taken the logarithm of the parameter. Further, it is useful to constructboth sentinels of maximal height.- In the class SkipList it is useful to write a method which simulates coin flip andreturns the number of all tosses until the first head comes up. This number representsthe height of a node to be inserted.- In the class SkipList implement the following methods:(i) insert, which…
- Revise Heap , using a genericparameter and a Comparator for comparing objects. Define the class as follows:class HeapWithComparator<E> {private Comparator<? super E> comparator; // For comparing elements public HeapWithComparator() {// Implement no−arg constructor by creating a comparator fornatural order}public HeapWithComparator(Comparator<? super E> comparator) {this.comparator = comparator;}// Implement all add, remove, and getSize method}void build (int[] elts, int N); // The "magic" build operation which constructs a heap in O(N) time// the first parameter is an array that contains all the elements that// will go into the heap; the second parameter tells how many elements// there are (so that the array "elts" can be larger than the number// of elements in it... we do not depend on elts.length to determine// the size of heap we build.//// The method works as follows: // first: the heap that is doing the build will do a clear() // and it will lose any elements already in that heap// second: load the elements in parameter "elts" into the heap// array directly ( a O(N) copying action )// third: perform the "bubble down" operations that a build// requires on the heap array// // When testing look to find a sequence of elements that let you // get two different heap structure when you // 1) create a heap from N separate inserts// 2) do this build method//// Here is one such sequence: 101, 37, 26, 19, 15, 12, 9, 2, 3, 5////…JAVA PROGRAMMING Q4.1: You have two sequences of mutually-comparable items to sort: The sequences are identical in terms of their sizes, their items, and the current (unsorted) order of those items. One sequence is in an array and the other is in a linked list. For the array and the link list, make an argument for why the quick sort would be best for one and the merge sort for the other. In the identified situation, give a quantitative answer based on big-O and other technical factors, not just a qualitative answer. Address the specifics of the two algorithms -- their operations, time efficiency, money use, etc. Assume no optimization Q4.2: Explain and/or illustrate the specific changes made in each pass of an Insertion Sort on the following data: 47 4 22 13 9 12
- Implement the class MaxHeapPQ that implements the interface MaxPriorityQueue using the maximum-oriented heap. Add a method min() to find the minimal key of a maximum-oriented heap priority queue. note: - create a file MaxHeapPQ.java . You may start with the Java program with this file(the code below) and also provide output screenshot. import java.util.Iterator; import java.util.ArrayList; class MaxHeapPQ<K extends Comparable<K>> implements MaxPriorityQueue<K> { private K data[]; private int size; private int capacity; // constructors public MaxHeapPQ() { capacity = 100; size = 0; data = (K[]) new Comparable[capacity]; } public MaxHeapPQ(int c) { capacity = c; size = 0; data = (K[]) new Comparable[capacity]; } // required priority queue methods public boolean isEmpty(){ //ADD CODE } public void add(K x) throws Exception { //ADD CODE } public K removeMax() throws Exception { if (size <= 0) throw new Exception("Priority Queue Empty"); //ADD CODE } // auxiliary…Implement Circular Queue ADT using a circular doubly linked list, the ADT have to be in following convention: Template Class CircularQueue { DoubleList dll; ///////////////////////// Setter/Getters Constructors/ destructor Virtual bool Enqueue(type value)=0; Virtual bool Dequeue(type &value)=0; Virtual bool Front (type &value)=0; Virtual bool Rear (type &value)=0; Virtual void Display( )=0; //Any other function } Task is to extend this class by MyCircularQueue and override the above all pure virtual functions. In C++In PriorityQueue.java, write code for the following new functions:1. public boolean add( PriorityQueueNode x )This function adds a new node x to the priority queue. The node is added tothe heap by comparison of the rating attribute. It involves the “percolateup” process and returns true when finished. 2. public PriorityQueueNode remove( )This function removes the minimum element of the priority queue and returnsit. It involves a call to percolateDown( int hole ). 3. private void percolateDown( int hole )This function takes the position of the next available hole in the priority queueand uses it to bubble the elements through the heap until the heap property isrestored. 4. public void display( )This function prints out a formatted tree representation of the priority queueshowing only the rating of each node. The output should resemble that of atree. Tip: you may use the StringBuilder class and the Stringformat( ) method. Empty nodes in the tree can be replaced with “--”.Example output…
- Complete the following class in java all the methods according to the requirements shown in the rubric import jsjf.exceptions.*; /** * LinkedHeap implements a heap. * * @author Java Foundations * @version 4.0 */ public class LinkedHeap<T> extends LinkedBinaryTree<T> implements HeapADT<T> { publicHeapNode<T> lastNode; publicLinkedHeap() { super(); } /** * Adds the specified element to this heap in the appropriate * position according to its key value. * * @param obj the element to be added to the heap */ publicvoidaddElement(Tobj) { HeapNode<T> node = newHeapNode<T>(obj); if (root == null) root=node; else { HeapNode<T> nextParent = getNextParentAdd(); if (nextParent.getLeft() == null) nextParent.setLeft(node); else nextParent.setRight(node); node.setParent(nextParent); } lastNode = node; modCount++; if (size() > 1) heapifyAdd(); } /** * Returns the node that will be the parent of the new node * * @return the node that will be the…In this task, a skip list data structure should be implemented. You can follow the followinginstructions:- Implement the class NodeSkipList with two components, namely key node and arrayof successors. You can also add a constructor, but you do not need to add anymethod.- In the class SkipList implement a constructor SkipList(long maxNodes). The parameter maxNodes determines the maximal number of nodes that can be added to askip list. Using this parameter we can determine the maximal height of a node, thatis, the maximal length of the array of successors. As the maximal height of a nodeit is usually taken the logarithm of the parameter. Further, it is useful to constructboth sentinels of maximal height.- In the class SkipList it is useful to write a method which simulates coin flip andreturns the number of all tosses until the first head comes up. This number representsthe height of a node to be inserted.- In the class SkipList implement the following methods:(i) insert, which accepts…Java Consider the following class definition for an array-based stack implementation:pubic class Stack { private int[] m_array; private int m_index; public Stack(int cap) { m_array = new int[cap]; m_index = 0; } public void push(int v) { if (m_index == m_array.length) throw new RuntimeException("push attempted on a full stack"); else { m_array[m_index] = v; m_index++; } }} Follow the steps below to create a class SpecialStack with required instance variables and methods.a. Make sure that the SpecialStack class inherits from Stack. b. Declare two private instance variables: a boolean variable m_multiply, and an int variable m_number.c. Create a constructor that takes three parameters: an int cap, a boolean multiply, and an int number.d. The constructor should call the constructor of the super class and initialize the instance variables properly.e. Override the push method so it verifies if m_multiply is…