|Get Selected Weeks Solution with ONLY||NOT||Add Selected Tutorials To Cart|
GSP295 - Week 2 iLab
Sorted List Lab (70 points)
A single zip file including the following.
If you document any issues, it will be easier to isolate any problems, provide detailed help, and could potentially improve your grade.
In this Lab, you will create a sorted ADT list and a test driver in order to verify its correctness. You will also profile the main ADT list operations in order to see the differences in Big-O run-times.
Part 1: ADT Implementation Overview
Elements in your sorted list should be string elements. The ADT sorted list chapter in your textbook reviews the implementation steps and provides source code to help you.
Hint: Your textbook uses the itemType structure and template. This is a good way to implement a generic ADT; however, it complicates the implementation, and it is not required for this course. If you are comfortable with the itemType structure and want to use it, you are welcome to. If you are not, you may change all itemType parameters to strings. For all Lab assignments in the course, the focus will be on strings. Notice that if you elect to use strings, you will also need to change the code that refers to item ComparedTo to a set of if/else statements using basic string comparison. You may also need to modify the textbook source code to pass variables by reference. You may use #include <string> to assist you with strings.
Part 2: Test Driver
You will need to create a driver routine to test all of the functionality of the sorted list ADT. This would be similar to what you did with Week 1 using command line instructions. You must implement at least one command for all eight ADT operations listed in your text. In addition, you must include a Print command that outputs the contents of your list (in order) for testing purposes. Remember that you are implementing a sorted list; as such, your list should be sorted at all times. For the purposes of this assignment you should use strings as the items to hold/sort.
Example commands might include the following.
You may choose the specifics of the input/output as long as your program gives enough information. Menu driven commands are perfectly fine. Make sure you explain your commands and how to interact with your program in your write-up and/or your console user interface. Make sure you check for all error conditions. For example, you can’t insert into a full list or delete from an empty one.
Design and implement a test plan. Write up your results. Does everything work? If not, fix and retest. Submit your final test results, any issues you are having with your program, and explain what tests you ran to determine those issues. In other words, describe your test plan.
Part 3: Big-O Run-Times and Profiling
An important part of writing efficient code is being able to profile it by testing its relative speed. You are learning about Big-O run-times in this course for all data structures. However, it is helpful to experience the actual effects of Big-O in terms of milliseconds of run-time.
Be sure to add this include file in your ADT and main drivers.
Modify your PutItem, DeleteItem, and GetItem operations to take an additional parameter; double and timetaken that will be set to the execution time of these operations. You can profile an operation in this way by adding this code to the very top of the operation.
start = GetTickCount();
And this code at the bottom of the operation.
end = GetTickCount();
timetaken = (end-start);
Modify the MAX_ITEMS variable in your ADT list to handle at least 1,000,000 list items. Tweak this number as needed based on the instructions below.
You can create a series of random five-character strings very easily to test your sorted list. Create a special test driver command that will do this. To make this easier for you, the basic code you will need to create random strings is provided.
Call your ADT PutItem operation to insert 1,000,000 strings into your ADT sorted list. Adjust the number of strings depending on the speed of your machine and use your best judgment. An appropriate amount of wait time should be in the 5-10 seconds range. Adjust the maximum number of elements to achieve a time in this range. If your code executes instantaneously, increase the amount of strings as needed.
In addition, make approximately 1,000,000 calls to your GetItem operation using both a string you know is in the list, astring[400,000] for example, and one that you know is not, “abcdefghij” for example. Then make approximately 1,000,000 calls to your DeleteItem operation. You should use the same number of calls you used for PutItem in order to obtain results you can compare.
Use cout to output the millisecond times for each of these operations. Now modify the 1,000,000 value, or whichever base value you are using, to be double and triple the size. Also run tests with half and one third the base size.
Make a table of the results for each of the three operations and explain the effect you are seeing. What is the Big-O run-time of your PutItem, GetItem and DeleteItem operations in your implementation? Include these results in your Lab write-up.
Hint: Be careful not to call your ADT operations inside the for loops generating your random strings; this may interfere with your results. Generate the strings first, and then make your ADT operation calls. Make sure to measure each operation separately. For example, measure 1,000,000 PutItems rather than 1,000,000 PutItems followed by GetItems
General iLab Comments
All coding assignments for this class will be using Microsoft Visual Studio. This is available through the Software Store, which can be found in Course Home. Contact the help desk if you encounter any issues or contact your professor.
*Please note as a reminder that you may not copy code from any web reference to complete this assignment, even if you correctly give credit. You may of course use web references to help you understand, but you must code the assignment yourself. You may use code directly from your textbook where applicable, but do make sure you give credit in your comments if you are doing so.
Here is solution for GSP295 - Week 2
It is 100% correct.
Solution contain Visual Studio C++ project and document answer all questions.
If you have more questions, please contact me via email email@example.com
I will help you any time
Thank you very much