#include "ExtendedBinaryTree.h" #include "ExtendedBinaryTreeNode.h" #include "Ware.h" #include void generateRandomIntArray(int *array, int arrayLength) { std::srand(time(NULL)); for (int i = 0; i < arrayLength; i++) { array[i] = rand() % 100000 + 1; } } int main() { // bez, sn, gw, ek, vk Ware ware1("S", 1, 5.12, 10.37, 13.0); Ware ware2("L", 2, 6.12, 1.37, 29.0); Ware ware3("A", 3, 4.12, 9.37, 10.0); Ware ware4("Z", 12, 1.12, 18.37, 19.0); Ware ware5("LA", 27, 0.12, 13.37, 17.0); Ware ware6("LC", 13, 13.12, 15.37, 16.0); Ware ware7("ABC", 4, 7.12, 27.37, 35.0); Ware ware8("C", 123, 9.12, 2.37, 4.0); int randInts[8]; generateRandomIntArray(randInts, 8); // Händisch sortierte Prioritäten, um die Waren ihren Prioritäten entsprechend // einzusortieren, damit die Heapbedingung nicht verletzt werden kann. std::sort(randInts, randInts + 8); ExtendedBinaryTree tree(&ware1, randInts[0]); // std::cout << tree.printPreorder() << std::endl << std::flush; tree.insert(&ware2, randInts[1]); // std::cout << tree.printPreorder() << std::endl << std::flush; tree.insert(&ware3, randInts[2]); // std::cout << tree.printPreorder() << std::endl << std::flush; tree.insert(&ware4, randInts[3]); // std::cout << tree.printPreorder() << std::endl << std::flush; tree.insert(&ware5, randInts[4]); // std::cout << tree.printPreorder() << std::endl << std::flush; tree.insert(&ware6, randInts[5]); // std::cout << tree.printInorder() << std::endl << std::flush; tree.insert(&ware7, randInts[6]); // std::cout << tree.printInorder() << std::endl << std::flush; tree.insert(&ware8, randInts[7]); std::cout << tree.printPreorder() << std::endl << std::flush; // std::cout << ware1 << std::endl; // std::cout << tree.printPreorder() << std::endl; // std::cout << tree.printPostorder() << std::endl; // std::cout << tree.printPreorder() << "\n" << std::endl; // std::cout << tree.printPostorder() << "\n" << std::endl; // std::cout << tree.printInorder(); std::cout << tree.printPriority() << std::endl; return 0; }