Unformatted text preview:

CSCI 2320 Data StructureQuiz 1 Name:__________________Question1:Determine the Big O( ) notation for the following: (50 pts)1. n3 + n3 2. 0.005n3 + n 3. 10n3 + 2n5+ 200n2+ 30n34. n(10n3 + 50m)5. m(10n3 + 50mn)6. m(10mn3 + 50mn)O(n3 )O(n3 )O(n5)O(n4 + mn)O(m n3 + m2n)O(m 2n3)Question2: Please read into the following code and determine:(1) In terms of m, n, please determine the following code’s O ( n3 + m ) (25 pts)(2) In your own words, what is the code doing? (25 pts)Find the maximum continuous sum for 2 arrays (a and b) with 2 different approach.One cost O(n3) while the other cost O(m)int maxSubSum(int a[], int b[]){ int n = a.size(); int maxSum = 0; for(int i = 0; i < n; i++){ for(int j = i; j < n; j++){ int thisSum = 0;for(int k = i; k <= j; k++) thisSum += a[k];if( thisSum > maxSum){ maxSum = thisSum; seqStart = i; seqEnd = j; } } } cout<<maxSum; int m = b.size(); int thisSum = 0, maxSum = 0; int i=0; for( int j = 0; j < m; j++){thisSum += a[j];if( thisSum > maxSum){maxSum = thisSum;seqStart = i;seqEnd = j;}else if( thisSum < 0) {i = j + 1;thisSum = 0;} } cout<<maxSum;


View Full Document

GSU CSC 2320 - Quiz 1_key

Download Quiz 1_key
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Quiz 1_key and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Quiz 1_key 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?