Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java program: Convex Hull using Divide and Conquer Algorithm A convex hull is the smallest convex polygon containing all the given points. Input is
Java program: Convex Hull using Divide and Conquer Algorithm A convex hull is the smallest convex polygon containing all the given points. Input is an array of points specified by their x and y coordinates. The output is the convex hull of this set of points. Examples: Input: points[] = {(0, 0), (0, 4), (-4, 0), (5, 0), (0, -6), (1, 0)}; Output: (-4, 0), (5,0), (0, -6), (0, 4) use Divide and Conquer Algorithm please explain the complexity and write good comments 3. Consider the following "divide-and-conquer" algorithm: algorithm printer begin Input: int n for i = 1 ton do for j = 1 to ln i do printline "hello world" if n > 0 then for k 1 to 3 do printer ([n/3]) end Let T(n) denote the number of lines of output generated by a call of printer(n). Hint: you may want to use Stirling's approximation: Inn! nlnn - n. (a) Give a recurrence for the value of T(n) of the above divide-and-conquer algorithm. (4 marks) The following is a typical expression of a recurrence relation/equation often found in the analysis of algorithms that use the divide-and-conquer algorithmic design pattern: T(n)T(n/b)+cn where a, b, and c are arbitrary positive constants. For the purpose of the following questions, assume that bis a positive integer. (Show your work to justify your answers.) (a) Provide a tight big-Oh characterization of 7(n) when ab. (b) Does your answer change when a 4. Write a program to use divide and conquer algorithm design to find the maximum and the minimum data in array: int a[8] (20,5,7,25,30,1,9,12); 20 57 25 30 1 9 12 20 5 7 25 30 1 9 12 20 5 7 25 30 1 9 12 max=12 Max 20 Min 5 max=25 min-7 max=30 min=1 A Max-25 max-30 Min-5 min=1 Max-30 Min-1 min 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started