Write the necessary statements to accomplish each of the
Write the necessary statements to accomplish each of the
UMUC CMSC 230 Homework Exercises Set 11CMSC 230 Homework Exercises Set 1 (HW1) for Brandon SmallDr. Ioan Salomie isalomie@faculty.umuc.eduExercise 1.1(bs)Given the following array declaration:String[] dayOfWeek;Write the necessary statements to accomplish each of the following (machine execution is not required):a) Allocate memory for an array of seven strings.b) Set the first element to “Sun”.c) Concatenate “day” onto the end of the first element.d) Display the elements of the array, each on a separate line.Exercise 1.2 (bs) Write the method insertZero that accepts an integer array of unspecified length as a parameter. Insert a zero into the array after the first negative number, shifting the subsequent values one position to the right, removing the last value. For example, the array {3, 5, -2, 4, 5, 6, 3} should become {3, 5, -2, 0, 4, 5, 6}. If the array contains no negative values, leave the array unchanged.Do not copy the array, but modify the array that was passed as a parameter.What is the Big-O of the method?Indications and Deliverables: Integrate the method code into the attached test driver Test12.java. Compile and run the program. Submit the modified Test12.java file.Exercise 1.3 (bs) For each of the program fragments below, determine the execution time in terms of Big-O Notation.UMUC CMSC 230 Homework Exercises Set 12Program fragment a.for(int i = 0; ifor (int j = 0; j// this block contains an operation of O(1) complexity}}Program fragment b.for(int i = 0; ifor (int j = 0; j// this block contains an operation of O(log n) complexity}}Program fragment c.for (int i = 0; i// this block contains an operation of O(1) complexity}for (int j = n; j > 0; j–) {// this block contains an operation of O(log n) complexity}Exercise 1.4 (bs)The execution times for three algorithms are given below (the base of the logarithms is 2):a. 10 * log N + 100b. 10 * log N + Nc. 3 * N^2 – 2 * N * log NWhat is the Big-O notation corresponding to each of the above execution times?Exercise 1.5 (bs) Evaluate each of the following postfix expressions. If an expression is ill-formed specify “ill-formed expression”.a. 9 8 7 + 6 5 – * +b. 1 2 3 – + 4 5 + * –
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


