cs201_hw2_2009 - CS 201, Fall 2009 Homework Assignment 2...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 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....
View Full Document

This note was uploaded on 02/01/2010 for the course CS CS-201 taught by Professor Selimaksoy during the Fall '09 term at Bilkent University.

Page1 / 5

cs201_hw2_2009 - CS 201, Fall 2009 Homework Assignment 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online