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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:18:30+00:00 2026-06-04T17:18:30+00:00

I am using as a data structure for represent a graph,a HashMap – HashMap

  • 0

I am using as a data structure for represent a graph,a HashMap – HashMap (one for the locality and one inside the locality in order to represent the destinations) , i had inserted 20 000 localities.
Now i need to make a function to know if exist a path between two Localities, this function is recursive and it require me to make a lot of get objects of my hashMap to work with them.
For each destination to make i have always to execute the method get in my api, to give me a copy of the hashMap with the destinations
Everytime that i run my program, i get a Stackoverflow error. Why this always happen ? it’s due the high recursive calls? Or it ‘s due the constantly call get method to have a copy of the hashMap of the locality’s destinations?

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-04T17:18:32+00:00Added an answer on June 4, 2026 at 5:18 pm

    Stack overflows are caused by the recursion depth exceeding some fixed limit. This probably has nothing to do with copying the HashMap; that would cause an OutOfMemoryError. If you are doing a graph search recursively, the error is likely caused by either

    1. A depth-first search going too deep, or
    2. A bug in your recursion logic.

    Without more data I can’t say which it is. Do note, though, that DFS can be written iteratively using an explicit stack to store the nodes to explore. Posting more code would help us make a better diagnosis.

    Hope this helps!

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

Sidebar

Related Questions

I'm using the Composite pattern to represent a hierarchical data structure: CompositeNodeA Leaf1 Leaf2
What is the best way to represent this data structure? I'm using Objective-C for
I am used a structure to represent pure data. One of the fields is
I am using a 1D vector to represent a 3D data structure, with indices
i have data structure i am passing this from server to client using data
Using EF4 and Linq I have a data structure which looks like this: parentid
I'm using the STL map data structure, and at the moment my code first
I'm using a particular database table like a Set data structure, i.e., you can
I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1
I have few questions about using lock to protect my shared data structure. 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.