1 answer

Please check my answers if it wrong answer me a) (25 points) Suppose that you are...

Question:

a) (25 points) Suppose that you are asked to analyze the performance. Algorithms operate on 1D array of size nor 2D a of the
please check my answers if it wrong answer me
a) (25 points) Suppose that you are asked to analyze the performance. Algorithms operate on 1D array of size nor 2D a of the algorithms below, write down the Big O or order of grow terms of n. If the algorithm cannot be applied to the array, write 0(1), O(log n), O(n), O(n logn), 90), O(n"), O(n!). The will only be given for reasonable Big O answers. & algorithms for their array of size nx n. For each growth (worst case scenario) in dy, write NA. Select answers from Tirst answer is given. Full credit Algorithm Big O (order of growth) or NA 0(1) 1. Find the 5th element in an array of size n O(no) (2) CELE 2. Determine if a sorted array of size n has any duplicates 3. Determine if two unsorted arrays each of size n have any common elements 4. Binary search for a target value in an unsorted array o logn) (1) 5. Find the maximum element in a 2D array of size nxn 6. Check if a 2D array is symmetric. That is, a[i]6) - Gli] for all (1) (13) 7. Find all combinations of the n elements in an array of size n 8. Sort an array of size n using merge sort 9. In an array where all elements are distinct, find the second largest element 10. Merge two sorted arrays each of size n/2 into a single sorted array of size n oln) Low o(1)

Answers

Solution:

4) Binary search for a target value in an unsorted array : NA.(Binary searches require the arrays to be sorted)

5)Find the maximum element in a 2-D array of size n x n: O(n2). (It is equal to the complexity of a linear search in the 2-D array)

6)Check if a 2-D array is symmetric: O(nlogn). (The number of comparisons go on decreasing by 1 for every row)

7)Find all combinations of the n elements in an array of size n: O(n!). (Similar to finding all combinations of strings from a string)

8)Sort an array of size n using merge sort: O(nlogn). (The array is broken down into halves and each is sorted and then merged)

The rest are all correct!

.

Similar Solved Questions

1 answer
Please use C++ only Purpose : This stage involves recursion and recursion-like reasoning in coding while...
Please use C++ only Purpose : This stage involves recursion and recursion-like reasoning in coding while also actively preparing a critical component necessary. Description : Computers don’t natively understand mathematical expressions in the way we prefer to write them. While we prefer &ldquo...
1 answer
Red The unadjusted trial balance of XY Ltd shows a $2,200 balance for the office supplies...
red The unadjusted trial balance of XY Ltd shows a $2,200 balance for the office supplies account. At the end of the period, the office manager determines that the value of supplies on hand is $800. Which of the following is the required adjusting entry? on Select one: A. Supplies Expense Supplies P...
1 answer
Anemia Case Study A routine admission CBC was analyzed on a 16 year old white male...
Anemia Case Study A routine admission CBC was analyzed on a 16 year old white male using an automated cell counter. The results were: WBC:              8,200/ul RBC:           &...
1 answer
Managerial Accounting Fall 2020 A Muhammed Olasupo Homework: Chapter F:17 Homework HW SC Score: 0 of...
Managerial Accounting Fall 2020 A Muhammed Olasupo Homework: Chapter F:17 Homework HW SC Score: 0 of 1 pt 3 of 6 (3 complete) EF 17-16 (similar to) Dona for McCormick Designs, Inc. folio. (Click the icon to view the data) Read the requirements Requirement 1. Prepare a comparative common-size income ...
2 answers
An aqueous solution has a normal boiling point of 103.0
An aqueous solution has a normal boiling point of 103.0...
1 answer
12. In an embedded controller with on-chip ROM, why does the size of the ROM matter?
12. In an embedded controller with on-chip ROM, why does the size of the ROM matter?...
1 answer
A mission statement... Describes what an organization strives to be in the future. Normally contains a...
A mission statement... Describes what an organization strives to be in the future. Normally contains a threat assessment. Is an organized process for selecting strategies. Sets forth what the company is attempting to do....
1 answer
6. A survey of U.S. adults found that 86% of those who use the Internet keep...
6. A survey of U.S. adults found that 86% of those who use the Internet keep track of their online passwords in their heads. You randomly select 30 U.S. adults who use the Internet. Find the probability that the number who keep track of their online passwords in their heads is (a) exactly 25 (b) mor...
1 answer
Question 9 Question 9 (0.5 points) Buying stock on margin lowers your risk by limiting the...
Question 9 Question 9 (0.5 points) Buying stock on margin lowers your risk by limiting the maximum size of your loss to the amount of your own money that you invest. True False...
1 answer
Consider the following sets of quantum numbers. Which set(s) represent(s) impossible combinations?
Consider the following sets of quantum numbers. Which set(s) represent(s) impossible combinations?...
1 answer
20. (7') For each of the following applications, what cement type (I-V) would be most appropriate?...
20. (7') For each of the following applications, what cement type (I-V) would be most appropriate? If only a Type I is available, what chemical or mineral admixture can be used to provide the necessary performance? a) Winter construction of a warehouse in northeastern US b) Massive reservoir dam...
1 answer
A vertical straight wire carrying an upward 30?Acurrent exerts an attractive force per unit length of...
A vertical straight wire carrying an upward 30?Acurrent exerts an attractive force per unit length of 5.5...
1 answer
A person leaning over a 122 m -deep well accidentally drops a siren emitting sound of...
A person leaning over a 122 m -deep well accidentally drops a siren emitting sound of frequency 2450 Hz . Just before this siren hits the bottom of the well, find the frequency and wavelength of the sound the person hears Just before this siren hits the bottom of the well, find the frequency of the ...
1 answer
A proton enters a uniform magnetic field and follows trajectory B. Adeuteron (same charge and twice...
A proton enters a uniform magnetic field and follows trajectory B. Adeuteron (same charge and twice the mass) enters the magnetic field in the same way and with the same velocity as the proton. Which of the following is the right trajectory for the deuteron? CITIXYXXX XX E XXX 107 PM AZ OO A charged...
1 answer
Summit Systems has an equity cost of capital of 11.5 %​, will pay a dividend of...
Summit Systems has an equity cost of capital of 11.5 %​, will pay a dividend of ​$1.50 in one​ year, and its dividends had been expected to grow by 5.5 % per year. You read in the paper that Summit Systems has revised its growth prospects and now expects its dividends to grow at a ...
1 answer
Question 5 1 pts Consider a +1 cation of Manganese. There are electrons accounted for in...
Question 5 1 pts Consider a +1 cation of Manganese. There are electrons accounted for in the noble gas of the shorthand electron configuration. For the outermost electrons, there are electrons in the s orbital and electrons in the d orbitals. Hint: Write out the shorthand electron configuration of t...
1 answer
Part A A particle with a charge q = – 7.2 x 10-19C enters a magnetic...
Part A A particle with a charge q = – 7.2 x 10-19C enters a magnetic field with its velocity along positive x-direction with a speed v = 6.7 x 10 m/s. The magnetic field has a magnitude B=0.50T and its direction is given in the figure. (Figure 1) Find the magnitude of the force on the particle...