This project consists of three problems. For algorithm design questions, you can write pseudo-code, or explain...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This project consists of three problems. For algorithm design questions, you can write pseudo-code, or explain your answer in English. You need to submit your answer document through Canvas. Suppose we have a sorted array A in increasing order. Assume the array has starting index as 1 (rather than 0). It contains n positive integers. Given a positive integer number k, an interval [i, j] (1 ≤i≤j≤n) is defined as a good interval if it satisfies A[j] - A[i] ≤k.< A max good interval is a good interval with the cardinality maximized. Here is an example. ( Suppose that A is [1, 2, 4, 7, 8, 9, 10, 19], and k is 6, Intervals [1,4], [3,7], and [2, 5] are good intervals. Intervals [1, 5] and [6, 8] are not good intervals. Interval [3, 7] is a max good interval. < [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] I Good interval Good interval(max good interval) Good interval Not Good interval Not Good interval Problem 1: 1) Suppose that A is [2, 3, 7, 9, 11, 13, 15, 16, 17, 22, 24], and k is 9. Please write out a max good interval in A. (10%)< For Example: If A is [20, 21, 25, 26, 30, 31, 32, 34,37,39] and k is 7, Then, your answer can be [3, 7] or [5, 9], as indicated below, both contains five elements, and both are correct. ( [20, 21, 25, 26, 30, 31, 32, 34,37,39] or [20, 21, 25, 26, 30, 31, 32, 34,37,39] 2) Now, given any sorted array A in increasing order and a positive integer k, pleas design an algorithm to find a max good interval. What is the running time in terms of big-Oh. (20%)< This project consists of three problems. For algorithm design questions, you can write pseudo-code, or explain your answer in English. You need to submit your answer document through Canvas. Suppose we have a sorted array A in increasing order. Assume the array has starting index as 1 (rather than 0). It contains n positive integers. Given a positive integer number k, an interval [i, j] (1 ≤i≤j≤n) is defined as a good interval if it satisfies A[j] - A[i] ≤k.< A max good interval is a good interval with the cardinality maximized. Here is an example. ( Suppose that A is [1, 2, 4, 7, 8, 9, 10, 19], and k is 6, Intervals [1,4], [3,7], and [2, 5] are good intervals. Intervals [1, 5] and [6, 8] are not good intervals. Interval [3, 7] is a max good interval. < [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] [1, 2, 4, 7, 8, 9, 10, 19] I Good interval Good interval(max good interval) Good interval Not Good interval Not Good interval Problem 1: 1) Suppose that A is [2, 3, 7, 9, 11, 13, 15, 16, 17, 22, 24], and k is 9. Please write out a max good interval in A. (10%)< For Example: If A is [20, 21, 25, 26, 30, 31, 32, 34,37,39] and k is 7, Then, your answer can be [3, 7] or [5, 9], as indicated below, both contains five elements, and both are correct. ( [20, 21, 25, 26, 30, 31, 32, 34,37,39] or [20, 21, 25, 26, 30, 31, 32, 34,37,39] 2) Now, given any sorted array A in increasing order and a positive integer k, pleas design an algorithm to find a max good interval. What is the running time in terms of big-Oh. (20%)<
Expert Answer:
Answer rating: 100% (QA)
Problem 1 Given the sorted array A 2 3 7 9 11 13 15 16 17 22 24 and the positive integer k 9 lets fi... View the full answer
Related Book For
Research Methods For Business Students
ISBN: 9781292208787
8th Edition
Authors: Mark Saunders, Philip Lewis, Adrian Thornhill
Posted Date:
Students also viewed these programming questions
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In Exercises 7980, find the value of y if the line through the two given points is to have the indicated slope. (3, y) and (1, 4), m = -3
-
In a lawsuit filed by the Estate of Michael Jackson on behalf of his children, the plaintiffs' accounting expert had to forecast the lost earnings that resulted from his death. What factors would you...
-
Belk Department Store is having a special sale this weekend. Customers charging purchases of more than $50 to their Belk credit card will be given a special Belk Lottery card. The customer will...
-
Both PM and benefits information systems make provisions for employee access and input. What access would you provide in each of these systems, and what leeway would you provide employees in reading,...
-
On average, there are 12 potholes per mile on a particular stretch of the state highway. Suppose the potholes are distributed evenly on the highway. a. Find the probability of finding fewer than two...
-
he Hossain Corporation reported the following balance sheet data for 2 0 X 4 and 2 0 X 3 : 2 0 X 4 2 0 X 3 Cash $ 9 4 , 0 2 5 $ 3 1 , 9 5 5 Available - for - sale debt securities ( not cash...
-
corporation is resisting the personal holding company tax, but the Tax Court sides with the IRS. Within 90 days after the adverse decision, one shareholder transfers his stock and $10,000 in cash to...
-
Take a look at the still from the film To Kill a Mockingbird. How does it look similar to our court layout and how does it differ? Witness Jury Deputy Sheriff Crown Counsel Accused Public Gallery ll...
-
Boris Bottlemore has just finished celebrating his new job promotion by consuming ten double shots of bourbon in a bar near his home. He staggers from the bar to his home, which is one of twenty...
-
What forms of gambling are legal and illegal in your state? Are there any particular games that fall into a gray area between permitted and prohibited activity? Is church bingo legal in your state?
-
Do the federal statutes making it unlawful to deprive persons of their civil rights under color of law have a significant deterrent effect on misconduct of law enforcement personnel? Or do these...
-
Refer to the table for Moola at the bottom of this page to answer the following questions. What is the equilibrium interest rate in Moola? What is the level of investment at the equilibrium interest...
-
Does your community impose criminal penalties for violations of zoning regulations? If so, are violations treated as strict liability offenses? Why is it often more effective for a local governmental...
-
Calculate f,(x,y), f,(x,x), f,(1, -1), and f,,(1, -1) when defined. (If an answer is undefined, enter UNDEFINED.) f(x, y) 750 + 6 - %3D ,(1, -1) = ,(1, -1)= [
-
(a) Find the equation of the tangent line to f(x) = x 3 at the point where x = 2. (b) Graph the tangent line and the function on the same axes. If the tangent line is used to estimate values of the...
-
You have been asked by a well-known national charity Work for All to carry out research into the effects of long-term unemployment throughout the UK. The charity intends to use the findings of this...
-
How may the formulation of an initial substantive theory help in the development of a research proposal?
-
Josef is entering the final year of a four-year sandwich programme, reading for a BSc in Banking and Finance. He spent his third year in an internship, gaining work experience in a small credit union...
-
Assume a gain margin of 20 dB and a plant with a nominal gain of 50/sec. Assume also that the minimum GM of the system is specified to 10 dB. To what maximum value of gain can the plant climb under...
-
Why does the torque constant of a servo motor fall at a high current?
-
a. What are the two advantages of resolvers over encoders? b. What are the two advantages of encoders over resolvers?
Study smarter with the SolutionInn App