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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:23:11+00:00 2026-05-13T18:23:11+00:00

Greetings code-gurus! I am writing an algorithm that connects, for instance node_A of Region_A

  • 0

Greetings code-gurus!

I am writing an algorithm that connects, for instance node_A of Region_A with node_D of Region_D. (node_A and node_D are just integers). There could be 100k+ such nodes.

Assume that the line segment between A and D passes through a number of other regions, B, C, Z . There will be a maximum of 20 regions in between these two nodes.

Each region has its own properties that may vary according to the connection A-D. I want to access these at a later point of time.

I am looking for a good data structure (perhaps an STL container) that can hold this information for a particular connection.

For example, for connection A – D I want to store :

node_A, 
node_D, 
crosssectional area (computed elsewhere) , 
regionB, 
regionB_thickness, 
regionB other properties, 
regionC, ....

The data can be double , int , string and could also be an array /vector etc.

  1. First I considered creating structs or classes for regionB, regionC etc .
    But, for each connection A-D, certain properties like thickness of the region through which this connection passes are different.
    There will only be 3 or 4 different things I need to store pertaining to a region.
    Which data structure should I consider here (any STL container like vector?) Could you please suggest one? (would appreciate a code snippet)

  2. To access a connection between nodes A-D, I want to make use of int node_A (an index).
    This probably means I need to use a hashmap or similar data structure.
    Can anyone please suggest a good data structure in C++ that can efficiently
    hold this sort of data for connection A -D described above? (would appreciate a code snippet)

thank you!

UPDATE
for some reasons, I can not make use of pkgs like boost. So want to know if I can use any libraries from STL

  • 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-13T18:23:11+00:00Added an answer on May 13, 2026 at 6:23 pm

    You should try to group stuff together when you can. You can group the information on each region together with something like the following:

    class Region_Info {
      Region *ptr;
      int thickness;
      // Put other properties here.
    };
    

    Then, you can more easily create a data structure for your line segment, maybe something like the following:

    class Line_Segment {
      int node_A;
      int node_D;
      int crosssectional_area;
      std::list<Region_Info>;
    };
    

    If you are limited to only 20 regions, then a list should work fine. A vector is also fine if you would prefer.

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

Sidebar

Ask A Question

Stats

  • Questions 500k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Because you use loadonce:true, then you prepare the data on… May 16, 2026 at 2:04 pm
  • Editorial Team
    Editorial Team added an answer If you have access to the remote servers, you need… May 16, 2026 at 2:04 pm
  • Editorial Team
    Editorial Team added an answer on sponsor.css you have div#sponsor-notify-me input#email-field there this padding:10px 10px… May 16, 2026 at 2:04 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Greetings, I'm working with a vendor who has implemented some code that uses a
Greetings all, I have some JSON code that looks like this: { playlist: [
Greetings, I've been writing some nasty code to support the undo/redo of deletion of
Greetings, The VBA code below will create an Excel QueryTable object and display it
Greetings, So far, my code compiles, but it changes white to black and then
Greetings, everyone! Examining my own code, I came up to this interesting line: const
Greetings, SO. I have some code which I've made attempts at compiling using gcc,
Greetings. I'm having troubles with the following legacy code. It's fine in everything except
Greetings, this is my very first question and I just do programming as a
Greetings Guru's, This is a little hard to explain, but I'll give it a

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.