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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:03:53+00:00 2026-06-15T07:03:53+00:00

The problem is to find periodic graph patterns in a dataset. So I have

  • 0

The problem is to find periodic graph patterns in a dataset. So I have 1000 timesteps with a graph(encoded as integers) in each timestep. So, there are 999 possible periods in which the graph can occur. Also I define a phase offset defined as (timestep mod period). For a graph which was first seen in the 5th timestep with period 2, the phase offset is 1.

I am trying to create a bidimensional array of lists in C++. Each cell contains a list containing graphs having a specified period and phase offset. I keep inserting graphs in the corresponding lists.

list<ListNode> A[timesteps][phase offsets]

ListNode is a class with 4 integer variables.

This gives me Segmentation fault. Using 500 for the size runs fine. Is this due to lack of memory or some other issue?

Thanks.

  • 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-15T07:03:54+00:00Added an answer on June 15, 2026 at 7:03 am

    Sounds like you’re running out of stack space. Try allocating it on the heap, e.g. through std::vector, and wrap in try ... catch to see out of memory errors instead of crashing.

    (Edit: Don’t use std::array since it also allocates on the stack.)

    try {
       std::vector<std::list<ListNode> > a(1000000);   // create 1000*1000 lists
       // index a by e.g. [index1 * 1000 + index2]
       a[42 * 1000 + 18].size(); // size of that list
    
       // or if you really want double subscripting without a wrapper function:
       std::vector<std::vector<std::list<ListNode> > > a(1000);
       for (size_t i = 0; i < 1000; ++i) {   // do 1000 times:
           a[i].resize(1000);                // default-create and create 1000 in each
       }
       a[42][18].size(); // size of that list
    
    } catch (std::exception const& e) {
        std::cerr << "Caught " << typeid(e).name() << ": " << e.what() << std::endl;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem statement: Find the right triangle that has integers for all sides and all
i have this problem to find a particular xml node l have post this
My problem is to find best view configuration for my application that have a
I have a very simple problem but cannot find a nice solution. I have
I have got this problem: Find the first element in a list, for which
I have a problem to find the right way to program dynamic fields. For
I have a problem to find common elements in two arrays and that's of
Problem: Find the number of integers 1 < n < 10^7, for which n
I have problem to find a good namespace design and class order. Imagine we
I have a problem with find the current date from past mktime . In

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.