Mintoris Forum

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


  • Full Member
  • ***
  • Posts: 12
Linked lists - any chance?
« on: Jul 17, 2018, 06:22 PM »
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


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

Data Structures