Question: Assignment - 5 : Heap Write a program which manages heap, where the elements of heap are geometries. It is arranged with the area of
Assignment : Heap
Write a program which manages heap, where the elements of heap are geometries.
It is arranged with the area of geometry. The program supports the following
functions:
inserting a geometry:
action: insert a geometry and arrange the heap by the area of geometry
input format: I t geometry
t: type of geometry among c for circle, r for rectangle, s for square
geometry field depends on the type of geometry as given t
c x y r xy for center, r for radius
rxyxyxy for left bottom comer and xy for right top corner
sxyxy for left bottom corner and for side length
output: none
get the largest area
action: remove the geometry from the heap and print its area
input format: get
output format: area of the removed geometry two floating point values and
if no geometry is in the heap.
Example
We assume pi
Neither STL nor any libraries are allowed. This program should be implemented
from scratch not by using any butlin libraries or functions
NO USE OF CHAT GPT IS ALLOWED!!!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
