#include <cstdlib>
#include <vector>
vector<int> heap;
#include <iterator>
class Disk
int ExtractMax();
void DisplayHeap();
private:
int Size();
vector<int> filet;
void DeleteMin();
public:
void insert(int file);
void DeleteMax();
};
void displaydisk();
int size();
};
class Heap
{
private:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <iterator>
#include"Disk.h"
cout<<*pos<<" ";
pos++;
cout<<endl;
filet.push_back(file);
int Disk::size()
int Heap::Size()
{
int madhesia=0;
vector<int>::iterator
pos=filet.begin();
while(pos!=filet.end())
{
return heap.size();
}
madhesia=madhesia+*pos;
heap.push_back(element);
pos++;
}
heapifyup(heap.size() -1);
}
return madhesia;
}
void Disk::displaydisk()
heap.push_back(element);
heapifyup1(heap.size()-1);
void Heap::DeleteMin()
{
if (heap.size() == 0)
cout<<"Element
Deleted"<<endl;
}
{
cout<<"Heap is
Empty"<<endl;
int Heap::ExtractMin()
{
return;
if (heap.size() == 0)
return -1;
}
heap.pop_back();
else
heapifydown(0);
cout<<"Element
Deleted"<<endl;
return heap.front();
}
}
int Heap::ExtractMax()
void Heap::DeleteMax()
{
if (heap.size() == 0)
if (heap.size() == 0)
return -1;
{
}
cout<<"Heap is
Empty"<<endl;
else
return;
}
return heap.front();
}
void Heap::DisplayHeap()
{
else
return -1;
}
cout<<endl;
if (child == 0)
return -1;
else
return p;
{
int l = 2 * parent + 1;
if (l < heap.size())
return l;
else
return -1;
{
int temp = heap[in];
heap[in] = heap[parent(in)];
heap[parent(in)] = temp;
heapifyup(parent(in));
int r = 2 * parent + 2;
if (r < heap.size())
return r;
}
}
heap[child] = temp;
heapifydown(child);
{
int temp = heap[in];
heap[in] = heap[parent(in)];
heap[parent(in)] = temp;
heapifyup1(parent(in));
{
void Heap::heapifydown(int in)
{
child = child1;
}
if (child1> 0)
{
int temp = heap[in];
heap[in] = heap[child];
heap[child] = temp;
{
child = child1;
heapifydown1(child);
}}
}
if (child > 0)
{
int temp = heap[in];
heap[in] = heap[child];