Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Identification of mistake/error(it can be any type of error or problem which may result in incorrect result) ? Explain why it is an error or

  1. Identification of mistake/error(it can be any type of error or problem which may result in incorrect result) ?
  2. Explain why it is an error or a problem ?
  3. Correct the problem or give an alternative solution ?

Please explain all the questions accordingly.

image text in transcribedimage text in transcribed

heaptype.cpp #include "heaptype.h" template void Swap (ItemType & one, ItemType & two) { ItemType temp; temp = one; one = two; two = temp; } template void HeapType:: ReheapDown (int root, int bottom) { int maxChild; int rightChild; int left Child; left Child = root* 2+1; rightChild = root* 2+2; if (left Child PQType:: PQType (int max) { maxItems = max; items.elements=new ItemType [max]; length = 0; } template PQType: :-PQType() { delete [] items .elements; } template void POType:: MakeEmpty() { length = 0; } template bool PQType:: IsEmpty() { return length == 0; } template bool PQType:: IsFull() { return length == maxItems; } template void HeapType:: ReheapUp (int root, int bottom) { int parent; if (bottom > root) { parent - (bottom-1) / 2; if (elements [parent] void POType: : Enqueue (ItemType newItem) { if (length == maxItems) throw FullPQ(); else { length++; items. elements [length-1] = newItem; items. ReheapUp (0, length-1); template void PQType:: Dequeue (ItemType & item) { if (length == 0) throw EmptyPQ(); else { item = items.elements [0]; items.elements [0] = items. elements[length-1]; length--; items. ReheapDown (0, length-1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago