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

  • Home
  • SEARCH
  • 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 6932587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:43:29+00:00 2026-05-27T11:43:29+00:00

Consider the following problem: We have two sequences of cargo loads which can contain

  • 0

Consider the following problem:

We have two sequences of cargo loads which can contain either grain or cattle. Now, we also have a sequence of cargo loads which we want to get from the initial sequences.

The initial sequences might look the following way, sequence we want to achieve is displayed to the right:

C   G                     
G   C                     
C   G                     G
C   C                     C
G   G                     G
 \ /
  ?

Now, at the ? spot one can pick the left cargo load or the right one. The picking should be done to match the wanted final sequence.

For example, we should pick Grain at the beginning and then the picture would become this:

    G                     
C   C                     
G   G                     G
С   C                     C
С   G                     G
 \ /
  ?  ---> G (we took it from the left)

So, does this problem has a well-known name? I realize that this can be solved by a simple dynamic programming algorithm, but I want to know more.

Basically, if there is something more to read about this problem, I would like to read it. For example, I have no ideas about the complexity of the algorithm if we have an infinite number of finite input sequences.

  • 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-27T11:43:30+00:00Added an answer on May 27, 2026 at 11:43 am

    I don’t have much insight to share, but here it is:

    • Let’s call the cargoes 0 and 1 instead of C and G, moreover, let’s label the two queues 0 and 1 instead of right and left.

    • First the algorithm can not be solved with infinite (streamed) input sequences. In the case of two input seqs having only 0 then a 1 outside of the “streaming visibility window”, you can’t aim for this 1 if your result sequence needs it, so you could be stuck, while there was an answer.

    • Since we can’t talk about infinity, let’s analyze the complexity of a solver. I can’t see much better than your algorithm… If result sequence has length m and we modelize the result as a sequence of 0 and 1 (for right and left), there are 2^m possible solutions. If we consider that at every step, on average there’s one chance out of two that only one input sequence will be valid, it means the other sequence will be invalid as well as other subsequent sequences. This should lead to an O(m!) complexity.

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

Sidebar

Related Questions

I currently have an odd problem with ASP.Net authentication. Consider the two following lines:
Consider following two tables: tag_names (tag_id, tag_name) tag_links (tag_id, image_id) An image can have
Propose to consider the following problem. Suppose we have some composite object. Are there
Consider the following problem: A multi-line string $junk contains some lines which are encoded
The problem is best explained by example, consider the following two models: class Topping(models.Model):
Consider the following problem: You have a class 'A' that serves as a base
This problem is only in IE. Consider the following HTML: <html> <body> <div style='position:absolute;left:1em;right:1em;top:1em;bottom:1em;overflow:auto;>
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider the following problem. We are given an array of elements belonging to one
Consider I have two tables, t1 and t2 t1 = (id, name), t2 =

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.