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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:50:10+00:00 2026-05-22T21:50:10+00:00

Supose i have (A,B) (A,C) (A,D) (B,C) (B,D) (C,D) (D,E) in a text file.

  • 0

Supose i have

(A,B)
(A,C)
(A,D)
(B,C)
(B,D)
(C,D)
(D,E)

in a text file. I’ll extract it using regular expressions.

I would like to insert the data in to a container so that it looks like this.

A->B,C,D
B->C,D
C->D
D->E

Which container do I use?

I need to be able to look up data on both the left hand and right hand side of the container, i.e. by key an value. So I need to be able to search/lookup

A,B,C,D in

A->B,C,D
B->C,D
C->D
D->E

and the B,C,D in

A->B,C,D

I need to be able to lookups and inserts in both the keys and the values to reiterate so if I get a (C,E) I can insert it to have

C->D,E
  • 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-22T21:50:11+00:00Added an answer on May 22, 2026 at 9:50 pm

    A std::vector with a one-off sort at the end may well be more efficient than something like a std::set (which will maintain ordering as you insert).

    My advice would be to pick the one that best matches the semantics of what you want to do, and then modify it later if you find that it is inefficient.

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

Sidebar

Related Questions

Suppose I have a text file that looks like this: 33 3 46 12
I have a sample xml file that looks like this: <Books> <Category Genre=Fiction BookName=book_name
Suppose I have a text file with data separated by whitespace into columns. I
Suppose I have 500 rows of data, each with a paragraph of text (like
Suppose I have a text file with some data I want to retrieve lost
Suppose I have a text file that says: This file has plain text Now,
We have a command line exe that takes input from a text file and
Supose i have (A,B) (A,C) (A,D) (B,C) (B,D) (C,D) (D,E) in a text file.
I run across this problem frequently suppose I have a text file that I
I have a text file that is almost sometimes 5 mb large. What I

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.