CSC 220.01 ASSIGNMENT 02 SUMMER 2019 TA
ASSIGNMENT INSTRUCTIONS PERFORMANCE TRACKER
ASMT GRADE YOUR GRADE
1. Assignment 02: 50 points w/ 5 E.C. points
2. Due Date & Time: 07-13-2019 at 11:55 PM
00 15
01 50
WHAT TO SUBMIT 02 50
1. Assignment Report TOTAL 115
2. Code
A: 90-100% B: 80-89% C: 70-79% D: 60-69% F: 0-60%
The course grader provides feedback to your
HOW TO SUBMIT assignments on iLearn.
• Please refer to the “Guidelines for All Assignments” and the
“Assignment Report Template” which we discussed in detail in assignment 00.
Please download: http://csc220.ducta.net/Assignments/Assignment-02-Code.zip
PART A – The Bag, 20 points
Define the method removeAllOccurrences for the class LinkedBag that removes all occurrences of the given
entries from a bag. Your program’s output must be identical to this output:
PART B – The Efficiency of Algorithms, 10 points
1. Show how you count the number of operations (not only 2. Consider the following two loops, 4 points:
basic operations) required by the algorithm, 4 points:
// Loop A
sumList(aList, n) { for (i = 1; i <= n; i++)
thisSum = 0; for (j = 1; j <= 10000; j++)
sum = sum + j;
lastSum = 5000;
for (int i = 0; i <= n; i++) { // Loop B
thisSum = thisSum + aList[i] * 2; for (i = 1; i <= n; i++)
} for (j = 1; j <= n; j++)
sum = sum + j;
return thisSum >= lastSum;
} Although Loop A is O(n) and Loop B is O(n2), Loop B can be
faster than Loop A for small values of n. Design and
implement an experiment to find a value of n for which
Loop B is faster.
This study source was downloaded by 100000839306532 from CourseHero.com on 07-27-2022 15:59:36 GMT -05:00
Updated: 6/27/2019 10:36 AM
https://www.coursehero.com/file/43531082/Assignment-02pdf/
ASSIGNMENT INSTRUCTIONS PERFORMANCE TRACKER
ASMT GRADE YOUR GRADE
1. Assignment 02: 50 points w/ 5 E.C. points
2. Due Date & Time: 07-13-2019 at 11:55 PM
00 15
01 50
WHAT TO SUBMIT 02 50
1. Assignment Report TOTAL 115
2. Code
A: 90-100% B: 80-89% C: 70-79% D: 60-69% F: 0-60%
The course grader provides feedback to your
HOW TO SUBMIT assignments on iLearn.
• Please refer to the “Guidelines for All Assignments” and the
“Assignment Report Template” which we discussed in detail in assignment 00.
Please download: http://csc220.ducta.net/Assignments/Assignment-02-Code.zip
PART A – The Bag, 20 points
Define the method removeAllOccurrences for the class LinkedBag that removes all occurrences of the given
entries from a bag. Your program’s output must be identical to this output:
PART B – The Efficiency of Algorithms, 10 points
1. Show how you count the number of operations (not only 2. Consider the following two loops, 4 points:
basic operations) required by the algorithm, 4 points:
// Loop A
sumList(aList, n) { for (i = 1; i <= n; i++)
thisSum = 0; for (j = 1; j <= 10000; j++)
sum = sum + j;
lastSum = 5000;
for (int i = 0; i <= n; i++) { // Loop B
thisSum = thisSum + aList[i] * 2; for (i = 1; i <= n; i++)
} for (j = 1; j <= n; j++)
sum = sum + j;
return thisSum >= lastSum;
} Although Loop A is O(n) and Loop B is O(n2), Loop B can be
faster than Loop A for small values of n. Design and
implement an experiment to find a value of n for which
Loop B is faster.
This study source was downloaded by 100000839306532 from CourseHero.com on 07-27-2022 15:59:36 GMT -05:00
Updated: 6/27/2019 10:36 AM
https://www.coursehero.com/file/43531082/Assignment-02pdf/