Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- int zabawa[65536];
- HeapByBlaze xD;
- char input = '*';
- int *arra = nullptr;
- int insert;
- int maxCzyMin = 1;
- int tempRozm;
- vector<int> xddd;
- while (input != 'q') {
- cin >> input;
- switch (input) {
- case '+':
- cin >> insert;
- xddd.push_back(insert);
- break;
- case '-':
- cout << xddd.back() << '\n';
- xddd.pop_back();
- break;
- case 'p':
- tempRozm = xddd.size();
- arra = new int[tempRozm];
- for (int i = 0; i < tempRozm; i++) {
- arra[i] = xddd[i];
- }
- if (maxCzyMin % 2 == 1)
- buildMaxHeap(arra, tempRozm);
- else
- buildMinHeap(arra, tempRozm);
- for (int i = 0; i < tempRozm; i++) {
- cout << arra[i] << ' ';
- } cout << '\n';
- break;
- case 'r':
- int rozmiar, podawana;
- xddd.clear();
- cin >> rozmiar;
- for (int i = 0; i < rozmiar; i++) {
- cin >> podawana;
- xddd.push_back(podawana);
- }
- break;
- case 's':
- maxCzyMin++;
- default:
- break;
- }
- }
- delete[] arra;
- return 13 / 56;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement