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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:09:26+00:00 2026-06-06T01:09:26+00:00

I have an ordered string that I need to present to a user: ABCCDDCBBBCBBDDBCAAA

  • 0

I have an ordered string that I need to present to a user:

ABCCDDCBBBCBBDDBCAAA

Objects represented by ‘B’ are tagged, such that 2 Bs will have a ‘~’ after them.

AB~CCDDCB~BBCBBDDBCAAA
AB~CCDDCBB~BCBBDDBCAAA
AB~CCDDCBBB~CBBDDBCAAA
and so on...

I’ve used the combinations library by Howard Hinnant and it works well for this simple case. My test code uses a vector of locations as ints that was sent through for_each_combination.

However, I’m lost as to what to do when I have multiple tags for B.

For example, 4Bs total need to be tagged, 2 by ‘~’ and 2 by ‘#’

AB~CCDDCB~B#B#CBBDDBCAAA
AB#CCDDCB~B~B#CBBDDBCAAA
AB~CCDDCB#B~B#CBBDDBCAAA
AB#CCDDCB#B~B~CBBDDBCAAA
ABCCDDCB~B~B#CB#BDDBCAAA
and so on...

The pseudocode I’ve written out is a cascade. After the first for_each_combination, for each of the resulting combinations, copy every other location to another vector and do another for_each_combination.

Considering the number of combinations I will be working with, I’m hoping there’s a better way.

  • 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-06-06T01:09:28+00:00Added an answer on June 6, 2026 at 1:09 am

    I believe I’ve answered my own question after a bit of looking.

    First, I switched from using Howard’s library to Hervé’s combinations library. The main draw is that using next_combination allows me to chain the combination calculations together, like so:

    do {
        do {
        cout << values << endl;
        } while (next_combination(values.begin() + 3, values.begin() + 5, values.end()));
    } while (next_combination(values.begin(), values.begin() + 3, values.end()));
    

    I need to massage this into an iterator, but this is exactly what I need.

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

Sidebar

Related Questions

I have a choice. I have a number of already ordered strings that I
I have an ordered list like this: var list = new List<String>(){aaa,aab,aac,baa,bab,bac}; I want
I have a need to store an ordered list of strings and am trying
I have a huge repository of files that are ordered by numbered folders. In
I have a table with a name (varchar) field that only holds numeric string
I have a a simple ordered list that could contain 1 million or more
I have a list of strings. Each string follows the pattern {Path}\UpdateTo{Version}-{Order}. I need
Say I have a set of Strings that I want to be ordered by
I have a number of string arrays. The string in every array are ordered
I have a List<T> that is holding several objects called tc of type TwitterCollection

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.