Question: Here is my c# code that I still have error. Could you help me to fix it? Also show me the output screen,please using System;

 Here is my c# code that I still have error. Could

Here is my c# code that I still have error. Could you help me to fix it? Also show me the output screen,please

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace PriorityQueueTask { class Heap { public Node[] heapArray; public int maxSize; public int currentSize;

public Heap(int mx) { maxSize = mx; currentSize = 0; heapArray = new Node[maxSize]; } public Heap(Node[] arr) { maxSize = arr.Length; currentSize = 0; heapArray = arr; } public bool isEmpty() { return currentSize == 0; } public bool Insert(int key) { if (currentSize == maxSize) return false;

Node newNode = new Node(key); heapArray[currentSize] = newNode; TrickleUp(currentSize++); return true; } public void TrickleUp(int index) { int parent = (index - 1) / 2; Node bottom = heapArray[index]; while (index > 0 && heapArray[parent].Data

if (rightChild

if (top.Data >= heapArray[largeChild].Data) break;

heapArray[index] = heapArray[largeChild]; index = largeChild; } heapArray[index] = top; } public void BuildHeap() { for (int i = (currentSize - 1) / 2; i >= 0; i--) { Heapify(i); } } public bool Update(int index, int newValue) { if (index = currentSize) return false;

int oldValue = heapArray[index].Data; heapArray[index].Data = newValue;

if (oldValue

return true; } public void ClearHeap() { currentSize = 0;

} public void DisplayHeap() { Console.Write("heapArray: "); for (int i = 0; i

int nBlanks = 32; int itemPerArow = 1; int column = 0; int j = 0; string dots = "................................"; Console.WriteLine(dots + dots);

while (currentSize > 0) { if (column == 0) { for (int k = 0; k

if (++column == itemPerArow) { nBlanks /= 2; itemPerArow *= 2; column = 0; Console.WriteLine(); } else { for (int k = 0; k Implement abstract data structure - Priority Queue. Use programs PriorityQueue Lab.cs and P-6.cs as references. The priorityQueue class contains integer data member only. The values of the integer numbers are the priorities. (The higher the number, the higher the priority). Operations defined in the PriorityQueue class are: 1) Extract highest priority 2) Add an integer to the priority queue Print the priority queue in the order of precedence You need to define or import the following classes: class Heap class PriorityQueue class Program (the class that contains the Main() method)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!