When asked to design and analyze an algorithm, be sure to provide the following:
2.Identify the input and the input size, n
3.Identify the elementary operation
4.Compute how many times the elementary operation is executed with respect to the input size n
5.Provide a Big-O asymptotic characterization for the algorithm's complexity
1.Let P be an image represented as an (n x m) 2-dimensional array of pixels. Design an algorithm that given an image P will rotate it clockwise by 90 degrees.
2.Let C be a set of circles each represented as a triple (x,y,r) where x,y is its center and r is its radius. Design and analyze an algorithm that given a set C of n circles determines if any of the circles intersect.
3.10 points Let A = [a1,a2,....,an] be a collection of integers. A pair (i,j) is called an inversion if i < j but ai > aj. For example, if A = [2,3,8,6,1] then the list of inversions is (1,5),(2,5),(3,4),(3,5),(4,5). Design an algorithm (provide good pseudocode) that, given a collection of integers A outputs a list of its inversions. Provide a complete anaysis of your algorithm.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.Solving idea for problem 2: in this problem we consider a circle as the area bounded by its circumference and not only its circumference. This implies, for instance, that the algorithm considers two circles intersect when one of them is completely contained within the other (even if their circumferences don’t touch in any point).
Geometrically the intersection condition for two circles (to have common points – either on the circumference or inner) can be formulated like: if the distance between their centers falls in the closed interval [|R1-R2|, R1+R2], then the two circles intersect....
By purchasing this solution you'll be able to access the following files: