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 7648051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:36:55+00:00 2026-05-31T10:36:55+00:00

Suppose we have an object that can be sorted using two or more comparison

  • 0

Suppose we have an object that can be sorted using two or more comparison functions. For instance a Box that has a length, a width, and a height. We can sort an array of boxes according to any of these fields.

Now consider two arrays of Box objects that contain identical boxes. In the first array the boxes are sorted in order of increasing size by their length. In the second array the boxes are sorted in order of increasing size by their height. Most likely these two sorted arrays will list the boxes in a different order.

We want to find a third array that has a subset of the boxes and has the property that if we sort them by either their length or their height, we will have the same sorted order.

Is this simply a matter of finding the longest common subsequence of boxes between the two sorted arrays? Is there a better way to do this or a nice implementation in C++ without having to implement the algorithm for LCS if that is the most practical way to go? Are there any data structures that maintain this property on their own that are practical?

  • 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-31T10:36:57+00:00Added an answer on May 31, 2026 at 10:36 am

    What you’ve just described is an instance of the longest common subsequence problem, which is NP-hard.

    Intuitively, you can view this as a matryoshka nesting problem. The only elements that satisfy the relation must perfectly fit inside one another, but using the square of their longest edge instead of rote topology.

    Here’s two related questions, plus a canned implementation in C++.

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

Sidebar

Related Questions

Suppose I have a customer object that has all of the standard customer properties
Suppose I have a UserControl whose DataContext is set to an object that has
In C#, suppose you have an object (say, myObject ) that is an instance
Suppose I have an object containing some data. How can I see that data
Suppose I have a method that takes an object of some kind as an
Suppose I have a Java method that returns a HashMap object. Because a LinkedHashMap
Suppose that I have two objects with the same property name that I am
Suppose I have an model object Event that contains a Venue . When I
Suppose you have a library that provides a method that accepts an object that
Suppose we have an object which represent a box. class Box { public: int

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.