Pagini recente » Cod sursa (job #2236137) | Cod sursa (job #1515864) | Cod sursa (job #156280) | Cod sursa (job #881246) | Cod sursa (job #1808413)
#include <iostream>
#include <fstream>
using namespace std;
#define MAX 200001
void add(int heap[], int numere[], int poz[], int &n, int x) {
int k = n + 1; //indicele nrului nou
n++;
v[k] = x;
numere[n] = x;
poz[n] = n;
while (k > 1 && numere[k] < numere[k / 2]) {
int aux = heap[k];
heap[k] = heap[k / 2];
heap[k / 2] = aux;
poz[heap[k]] = k;
poz[heap[k / 2]] = k / 2;
k /= 2;
}
}
void del(int heap[], int numere[], int poz[], int n, int nr) {
n--;
int k = poz[nr];
while(k < n / 2)
int heap[poz[nr]]
while (poz < )
}
int minim(int heap[]) {
return v[1];
}
int main()
{
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
//heap - indice heap[indice numere]
//numere - nrele
//poz - indice numere[indice heap]
int heap[MAX], numere[MAX], poz[MAX], n = 0, N, cod, x;
for (int i = 0; i < N; i++) {
fin >> cod;
if (cod != 3) {
fin >> x;
}
}
fin.close();
fout.close();
return 0;
}