Mintoris

Author Topic: Linked lists - any chance?  (Read 186 times)

MikeHersee

  • Full Member
  • ***
  • Posts: 11
Linked lists - any chance?
« on: Jul 17, 2018, 10:22 AM »
I was looking for a linked list data structure and didn't find one. Specifically, what I want is an array of linked lists. The reason I want it is for a particle simulation program, where you have a large number of particles to simulate. Rather than comparing the distance between each particle to each other particle to see if they're in influence range of each other each cycle, I will have lumped each particle into rough blocks, and then only need to compare a much smaller number of particles each time. Linked lists are better for this as the number of particles in each block will constantly vary, but the overall size won't vary much at all.

I know it might seem unnecessarily complicated to save what might appear to be a small amount of time, but when the number of particles goes up, the number of comparisons goes up exponentially. And I'm developing the code in principle here to be eventually transferred to a pc when it gets to be 3D, and that's when the number of particle distance comparisons becomes ridiculous in relation to the number of particles that influence each other.

So that's why an array of linked lists would be helpful. I can simulate it with arrays, but the code will be more complicated

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Linked lists - any chance?
« Reply #1 on: Jul 18, 2018, 04:05 PM »
Check out the link below. I think ArrayLists are what you are looking for.

Data Structures