Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3848872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:46:02+00:00 2026-05-19T16:46:02+00:00

The problem is as follows: Given a sequence L of n integers not necessarily

  • 0

The problem is as follows:
Given a sequence L of n integers not necessarily distinct , write an algorithm that computes the increasing subsequence of maximum length :

The recurrence equation that I developed is this:

I start the index from 0:

If j = n opt(j) = 0 (base case)
otherwise opt(j) = max j <i <= n such that Lj <Li = {opt(i) +1}

do you think is right to do so? the standard solution used for this typical problem is to first calculate the maximum increasing subsequence ending in Li for all elements of the sequence and then the maximum on these values, that is:

if i = 1 opt (i) = 1
otherwise opt (i) = max 1 <= j <= i-1 and Lj <Li = {opt (i)} +1

and then the max on these elements.

so I wanted to know if you think my solution was right anyway.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T16:46:03+00:00Added an answer on May 19, 2026 at 4:46 pm

    Here’s a hint: The loop invariant that will be trying to preserve in the algorithm is that a variable, k = index of the beginning of the longest increasing subsequence. So as you iterate through the sequence of integers [0…n] you increment the k value accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a problem, the count-and-say sequence is the sequence of integers beginning as follows:
When I write a C program, I encountered a problem that is as follows:
I have an optimization problem as follows. Given an array of positive integers, e.g.
A minimal code that reproduces the problem is as follows: <div class=cell> <input type=text
I'm facing a problem that I can summarize as it follows: I have a
I have a mysql problem, my query looks as follows but not complete SELECT
My boss has given me an assignment that I'm not sure is possible since
The problem I am facing is as follows: Given two polygons defining the borders
Problem Given two integers a, b, a < b. Display its decimal expansion. You
The problem I'm trying to solve is as follows: I'm given a sorted list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.