{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs201_hw2_2009

# cs201_hw2_2009 - CS 201 Fall 2009 Homework Assignment 2 Due...

This preview shows pages 1–3. Sign up to view the full content.

CS 201, Fall 2009 Homework Assignment 2 Due: 18:00, December 23, 2009 Question 1 (30 pts) This question has two parts: a. Read Section 2.4.3 (Solutions for the Maximum Subsequence Sum Problem) from the handout, study each of the four solutions, and understand how the upper bounds are found for the running time of each solution. b. Implement each of the four solutions. You must also write a driver (main) function that generates a vector that contains random positive and negative integers, and calls these solutions. Then, run each solution on your computer and report execution times when different input sizes are used. Specifically, you are expected to provide a table as in Figure 2.2 and a plot as in Figure 2.3. You are expected to try many different input sizes (many small inputs as well as large inputs) and observe the effects of different growth rates as in Figure 2.3. Also, provide the specifications of the computer you used to obtain these execution times. You can use the following code segments to compute the execution time of a code block: //Store the starting time clock_t startTime = clock(); ... //Compute the number of seconds that passed since the starting time cout << "Execution took " << double( clock() - startTime ) / CLOCKS_PER_SEC << " seconds." << endl; For these operations, you must include the ctime header file. Question 2 (70 pts) In this question, you will implement a banking system, similar to the one in the first homework, by using linked lists. The bank has multiple customers where each customer has an id, first name and last name. The customers can have multiple accounts where each account has an id and a balance. Note that there are no branches in this homework. In your implementation, you MUST keep the customers in a sorted linked list where the customers are stored as sorted according to their names. For each of these customers, you MUST use another sorted linked list to store her/his accounts where the accounts are stored as sorted according to account ids. The banking system will have the following functionalities; the details of these functionalities are given below: 1. Add a customer 2. Delete a customer 3. Add an account for a customer 4. Delete an account 5. Show the list of all accounts 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6. Show the list of all customers 7. Show detailed information about a particular customer Add a customer: The banking system will allow to add a new customer indicating her/his customer id, first name and last name. Since the customer ids are unique, the system should check whether or not the specified customer id already exists (i.e., whether or not it is the id of another customer), and if the customer exists, it should not allow the operation and display a warning message. Use the following conditions for sorting the customers in the list: The customers should be sorted according to last names.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern