Show the optimal substructure

Assignment Help Basic Computer Science
Reference no: EM131123200

Suppose you are given an array of n integers a1, a2, ..., an. You need to find out the length of its longest sub-array (not necessarily contiguous) such that all elements in the sub-array are sorted in non-decreasing order. For example, the length of longest sub-array for { 5, 10, 9, 13, 12, 25, 19, 70, 80 } is 6 and one such sub-array is {5, 10, 13, 19, 70, 80}. Note you may have multiple solutions for this case. Use dynamic programming to solve this problem. Your solution need to show:

1) the optimal substructure;

2) the pseudo code of your solution and its complexity; and

3) a few examples how your approach works. In cases where there are multiple longest sub-arrays, you just need to show one of them.

Reference no: EM131123200

Questions Cloud

What psychiatric disorder is roommate attributing to sue : You're studying for your upcoming psychology exam when your roommate breezes in, saying: What psychiatric disorder is your roommate attributing to Sue? How is this different from schizophrenia
Confidence interval estimate of the expected value : a. Estimate the standard deviation ofwhenx= 8. b. Develop a 95% confidence interval estimate of the expected value ofywhenx= 8.
Currently enrolled in business statistics : Of 300 business students, 100 are currently enrolled in accounting and 80 are currently enrolled in business statistics. These enrollment figures include 30 students who are in fact enrolled in both courses.
How could you explain the behavior of mary fiance : When your family gathers for Thanksgiving, your cousin Mary brings her new fiancé; it's the first time he's met the whole family, and his behavior is a little strained: How could you explain the behavior of Mary's fiancé using situational attribut..
Show the optimal substructure : a few examples how your approach works. In cases where there are multiple longest sub-arrays, you just need to show one of them.
To investigate the effect of management training : Management Training An experiment was conducted to investigate the effect of management training on the decision-making abilities of supervisors in a large corporation. Sixteen supervisors were selected, and eight were randomly chosen to receive m..
Essay discussing the jockey club powerful influence : 350 word essay discussing two examples to illustrate the Jockey Club's powerful influence over French Opera
What are the ethical issues raised by this procedure : Compare your reactions to that procedure with your reactions to an analogous one in which people are given false feedback that they possess a very favorable personality trait or a very high ability level.
Essay explaining how the great fire of london can be viewed : 350 word essay explaining how the great fire of London can be viewed as both a curse and a blessing

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Numbers as 4-bit words in 2''s complement form

Q. Assume the following numbers are represented as 4-bit words in 2's complement form. Perform the following operations and identify, in each case, whether or not an overflow occurs

  Concise statement of the nature of the project

A brief description (a paragraph of 100-200 words) providing the project background/context. e.g. is it based on a business need? a technical need? does it arise from the interests of a particular person/company?

  Developing a use case diagram

Read "The Spring Breaks 'R' Us Travel Service" of your textbook and identify name of the event, state the type of event and name the resulting use cases. Use the event decomposition technique.

  Austraria or a major river in another country

students are to write a retter home to their parents expraining the water crises and arguing for or against the use of recycled water.GEOGRAPHY:

  The company has two economics consultants

The company has two economics consultants. One of them, Juan, says that the company will not sell any of these warranties (at least in the long run), because people will figure out their strategy. The other economist, Fatima, says that the company sh..

  Incorporate this method into an application

Incorporate this method into an application that inputs a series of pairs of integers (one pair at a time) and determines whether the second value in each pair is a multiple of the first

  Find the transfer functions for the circuits

Write the dynamic equations and find the transfer functions for the circuits shown in Fig. 2.48.

  What do u get when u type in that subarray and why?

so there is an array called arr2=[ 1 2 3; -2 -3 -4; 3 4 5]; what does it mean to access the subarray arr2(:, 1:2:3)? like what do u get when u type in that subarray and why?

  Firm level of inventories

Ace Industries has current assets equal to $3 million. The company's current ratio is 1.5, and its quick ratio is 1.0. What is the firm's level of current liabilities? What is the firm's level of inventories?

  Question regarding the compatibility report page

The Setup program displays a Compatibility Report page that can point out possible application compatibility problems. You can sometimes solve these problems by updating or upgrading the applications.

  What is regression testing

What are some advantages and disadvantages of using centralized network management versus distributed network management?

  . write down each interaction with smartphone

Consider your smartphone as a system and use its calendar to set a calendar event with a reminder for your birthday. Write down each interaction between you and your smartphone as a scenario. Record all the interactions, including any feedback the sm..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd