Реализация линейной структуры данных и оценка эффективности работы со структурой в зависимости от размерности структуры, страница 5

                    cout<<endl<<"Complete!"<<endl;

                    cout<<"Results: " << endl;

                    cout<<"All operations: " << AllOperations<<endl;

                    cout<<"Size of struct BEFORE tests: " << size << endl;

                    cout<<"Size of struct AFTER tests: " << sizeAfter << endl;

                    cout<<"Differents in size are: " << sizeDiff << "% "<< endl;

                    cout<<"--------------------------------------------------------------------------------";

                    cout<<"Insert: "<<endl;

                    int CountInsert = cntInsert;

                    cout<<"Operations: "<<cntIns<<" with "<<CountInsert<<" elem. oper."<<" in middle "<<CountInsert/(cntIns+1)<<endl;

                    cout<<"Remove: "<<endl;

                    int CountRemove = cntDelete;

                    cout<<"Operations: " << cntRem << " with " << CountRemove << " elem. oper." << " in middle "<< CountRemove/(cntRem+1)<<endl;

                    cout<<"Find: " << endl;

                    long CountFind = cntFind;

                    cout<< "Operations: " << cntFin << " with " << CountFind << " elem. oper." << " in middle "<< CountFind/(cntFin+1)<<endl;

}

//------------END-----------------------------------

void main()

{

                    CList<Type> *l = new CList<Type>;

                    char c;

                    int data;

                    Menu();

                    while(1)

                    {

                                       if (kbhit())

                                       {

                                                           c = getch();

                                                           switch(c)

                                                           {

                                                           case '1': cout <<  "Input data: ";  cin>>data;  l->Insert(data); break;

                                                           case '2':      cout << "Input data: "; cin>>data; cout<<l->Delete(data)<<endl;  break;

                                                           case '3':      cout << "Input data: "; cin >> data; cout<<l->Find(data)<<endl; break;

                                                           case '4':      l->Print();break;

                                                           case '5':      l->ClearList(); l = new CList<Type>; break;

                                                           case '6': cout <<  "Input size of structure: ";  cin>>data;                     l->Test(data);break; getch();

                                                           case 27:     return;

                                                           }

                                                           Menu();

                                       }

                    }

}//main

Результаты тестирования.

Ниже приведены графики зависимости количества элементарных операций от  размера структуры (упорядоченный список) и таблица значений.  

Вывод

Как видно из графиков, зависимости количества элементарных операций от размера структуры получаются линейными близкими к линейным, что говорит о рациональности алгоритмов.