From c2b06e76f7fdbaac8589048b416a74d19484387a Mon Sep 17 00:00:00 2001 From: Jonas Date: Sat, 11 Feb 2017 13:10:52 +0100 Subject: *performance and stability test in main.cpp --- tree/.settings/language.settings.xml | 4 ++-- tree/src/main.cpp | 31 +++++++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tree/.settings/language.settings.xml b/tree/.settings/language.settings.xml index 16f6114..afdea9b 100644 --- a/tree/.settings/language.settings.xml +++ b/tree/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/tree/src/main.cpp b/tree/src/main.cpp index 869ccb1..3e7b795 100644 --- a/tree/src/main.cpp +++ b/tree/src/main.cpp @@ -15,27 +15,34 @@ int main (void) { cTree* a = new cTree(); - for (char b = ' '; b <= '~'; b++) + cout << "Filling with data..." << endl; + for (char b = ' '; b <= '~'; b++) //insert some data into tree { - stringstream ss; - string y; - - ss << b; - ss >> y; + for(char c = ' '; c<= '~'; c++) + { + stringstream ss; + ss << b; + ss << c; - a->insert(y); + a->insert(ss.str()); + } } - a->draw(); - cout << "-------------------" << endl; + //a->draw(); + cout << "size: "<< a->size() << endl << "Unbalance: " << a->gradeOfUnbalance() << endl << "Depth: " << a->depth() << endl; + + cout << "Balancing..." << endl; a->sort(); - a->draw(); + cout << "size: "<< a->size() << endl << "Unbalance: " << a->gradeOfUnbalance() << endl << "Depth: " << a->depth() << endl; + //a->draw(); + cout << "-------------------" << endl; + //a->draw(); - for(unsigned int i = 0; i < a->size(); i++) + /*for(unsigned int i = 0; i < a->size(); i++) { cout << (*a)[i]->getData() << ", "; } - cout << endl; + cout << endl;*/ /*while(1) -- cgit v1.2.3