Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAIN_FILE
- #include <iostream>
- #include "RandomGenerator.h"
- #include "HeapQueue.h"
- #include "TournamentQueue.h"
- #include "BubbleQueue.h"
- #include "SelectionQueue.h"
- #include "SimpleObject.h"
- int main (int argc, char * const argv[]) {
- RandomGenerator gen(277071); // tu nalezy wstawic numer indeksu
- // Wybor implementacji kolejki:
- SelectionQueueLazy<SimpleObject<int> > theQueue;
- // Proste, "silowe" testowanie kolejki
- SimpleObject<int> a = SimpleObject<int>(8);
- int licznoscxd[17] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 50, 75, 100, 125, 150, 175, 200 };
- for (int i = 0; i < 17; i++) {
- std::cout << "Ilosc elementow: " << licznoscxd[i] << std::endl;
- for (int j = 0; j < licznoscxd[i]; j++) {
- a.setValue(gen.getRandom(1, 20));
- theQueue.put(a);
- }
- std::cout << "Comparisons: " << SimpleObject<int>::getComparisons() << "\n";
- std::cout << "Copyings: " << SimpleObject<int>::getCopyings() << "\n";
- try {
- std::cout << "get: " << theQueue.get().getValue() << "\n";
- }
- catch (QueueException& exc) {
- std::cout << "get: empty\n";
- }
- std::cout << "Comparisons: " << SimpleObject<int>::getComparisons() << "\n";
- std::cout << "Copyings: " << SimpleObject<int>::getCopyings() << "\n";
- std::cout << std::endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement