Implementing a Queue Data Structure

15 Pages1956 Words438 Views
|
|
|
Data structure & algorithms assignmentNote: Please don’t forget to add harvard referencing at theend Any extra work I would be much appreciate Task 1This assignment requires you to produce fully working program/programs, which will compare operation times of various sorting algorithms for given sets of data.You should carefully consider the criteria below and then develop a fully documented program that will calculate the time taken to sort lists of 10, 100, 1000, and 10,000 integer numbers which will be supplied by the tutor in class. There should be a minimum of 3 sorting algorithms used in the program, including an insertion sort, a bubble sort and another sorting algorithm of your choice.The program is to be written in C/C++ using the Microsoft C++ compiler in console mode.You must write a report that includes the following: -A description of each algorithm used, including pseudo code and/or flowcharts.A full code listing with commentsA table of results showing the time required for each algorithm to execute once. Use thespeed of the insertion sort as a guide to compensate for different processor speeds.An explanation of how the timing of each algorithm is achieved.Justification of the best sorting algorithm to be used for the various data sets supplied.Any additional paperwork you consider necessary including additional research anddiscussions on sorting algorithms.Additional marks will be awarded for complexity and explanations of algorithms used includingdiscussions on how the test results were obtained. Task 2A bank has a call centre set up for customers and requires a piece of software to count and track waiting calls.The telephone system can only keep 20 calls on hold at any time.Once a call is made to the bank the following information is logged on a computer and put into a queue.
Both code tested by visual studio 2010Task 1:// Four sorting algorithm program //#include<iostream>#include<conio.h>#include<time.h>#include<windows.h>usingnamespace std;int menuChoice = 0;int main(){/*int a[50],n,i,j,temp; cout<<"Enter the size of array: "; cin>>n; cout<<"Enter the array elements: "; */ DWORD starttime,endtime;//variables to store start and end timesfloat totaltime;//a float variable for the total time system ("color b"); cout << "Sorting algorithm\n"; cout << " option one 10.\n"; cout << " option two 100.\n"; cout << " option three 1000.\n"; cout << " option four 10000.\n"; cout << " Enter your choice and press return: "; cin >> menuChoice; starttime = GetTickCount();//get the start timesrand(time(NULL));int a[10000];for(int i = 0; i < menuChoice; i++){a[i] = rand() % 10000 + 1;}int temp;for(int i=1;i<menuChoice;++i)

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents

Pages

+1 306 205-2269

Chat with our experts. we are online and ready to help.