1

we have a sequence of REAL numbers.all of the numbers are unique.we want to have an ascending sequence by changing some of these values.we are allowed to change any arbitrary numbers.how to find the optimum algorithm to determine the minimum number of necessary changes to make this sequence? we can use greedy or dynamic programming approach.

1 Answer 1

1

first find longest increasing subsequence http://en.wikipedia.org/wiki/Longest_increasing_subsequence

then change all numbers which do not belong to this subsequence to fit the rule

(proof: if we change less numbers and acquire ascending sequence, then the numbers which were not changed were initially forming increasing subsequence longer then 'longest')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.