Module 1 course project: arraylist real-world speed
IMPORTANT: Be sure your methods are all at the same indentation level (proper indentation – see screenshot below)
6. Copy the ArrayList.py file to this folder. We will use the ArrayList code to check the speed of this algorithm.
7. In this same folder, create a file called ArrayListActualSpeed.py. Type your name and the current date at the top of the code. Then, import the ArrayList class, the Client class, the Quicksort class, the date module from the datetime library, the time module, the random module, and the sys module.
8. In the same ArrayListActualSpeed.py file, display your name and the current date in the output to show that you are the author of this code.
9. In the same ArrayListActualSpeed.py file, create a list and read the records from the ClientData.csv file into Client objects and place the Client objects into the list.
10. In the same Python code file, create an ArrayList object. Let’s test the first scenario. If you accept jobs at the back of the line and then process the jobs from the front of the line, which data structure is best? Write code to test how much time that it takes to add the Client objects from the list into the ArrayList data structure. The ArrayList automatically adds the new records to the end of the data structure so add this time to the spreadsheet into the “Add many records to end of data structure” row in the Excel table.
11. Continue the ArrayListActualSpeed code and write code to test how much time it takes to remove all of the Client objects from the front of the ArrayList, one object at a time. Add this time to the spreadsheet into the “Pull all records off front of data structure” row in the Excel table.
12. Now, let’s test the second scenario. A customer service center receives calls from random customers. The customer service center must be able to quickly pull up the customer’s record. Is the ArrayList good for this scenario? Let’s see how long it takes to pull up random records. Write code to add all of the customers to the ArrayList again since we deleted all of the customers on the last step. Now, write code to test how much time it takes to display many random records. Add this time to the spreadsheet into the “Display random records” row in the Excel table.
13. Let’s consider the third scenario. Consider a credit card call center. The representatives may sign up new credit card accounts (add records). The representatives may answer customers’ questions (display random records). Finally, the representatives may delete a paid-off account at the request of the customer (remove records). Write code to test how much time it takes to add the Client records to the ArrayList, then randomly display records, and then randomly delete records. Add this time to the spreadsheet into the bottom row.
14. If the data is sorted, will the ArrayList run faster? If you have sorted data, you can use the search_sorted( ) method. We will talk about different searching methods in a couple of weeks! Let’s check the difference in speed for the ArrayList when you use sorted and unsorted data.
15. In your ArrayListActualSpeed.py code, add this line after you read the client records to sort the clients list:
Quicksort.sort(clients)
16. Then, find your search methods and change them from search( ) to search_sorted( )
17. Run the code and add the speeds to your Excel table in the “ArrayList (sorted data)” column.
Deliverables Part 1
· Complete the Module 1 Course Project Presentation deliverable
· TimeProcess.py code
· Client.py code
· ArrayListActualSpeed.py code
· Screenshot showing the code running with your name and date in the output
· Excel “Table of Speeds” table
image3.png
image1.png
image2.emf
Microsoft_Visio_Drawing.vsdx
Client
<<Stereotype>>
parameter
– __client_id
– __first_name
– __last_name
– __phone
– __email
+ __lt__(other) : boolean
+ __eq__( other ) : boolean
+ __str__( ) : string