• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

LinkedList issue

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using LinkedList's as part of java.util in an A-Star search. Is there a limit to the amount of values you can insert into a LinkedList? I thought that it expands its capacity as you insert values. Here's a example of the output:

OPEN LIST:
1 1
___________

1 1 <--Current Node
Neighbors:
1 2
2 1

OPEN LIST:
1 2
2 1
___________

1 2 <--Current Node
Neighbors:
1 3
1 1
2 2

OPEN LIST:
2 1
1 3
___________

2 1 <--Current Node
Neighbors:
2 2
3 1
1 1

OPEN LIST:
1 3
___________

1 3 <--Current Node
Neighbors:
1 4
1 2
2 3
No path found!

The neighbors should be added to the open list, but at some point are stopped being added. I can provide some code if need be. I'm just wondering if its something I'm just not aware about dealing with LinkedList. Thanks
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

The only limit on a LinkedList is memory availability.

Could you post some code for your A* implementation for us to look at?
 
Clancey Tanglefoot
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok well its a bit of a mess and not really commented at all, but here is the code for the search, I can supply the aStarNode code as well:


[ February 27, 2005: Message edited by: Clancey Tanglefoot ]
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please surround your code with [ CODE ] ... [ /CODE ] tags to keep the indentation. That's a bit of code to trudge through without indenting; can you give us an idea of where the problem lies? At least tell us which method is exhibiting the problem (produces erroneous output).

With regard to LinkedList, Horatio is correct: LinkedList is bound by memory only. Well, Collection.size() returns an int, so I suppose it's also bound by Integer.MAX_VALUE. You were thinking of ArrayList that has a capacity that is increased when it is reached, though it's still bound by the same two things as LinkedList.
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll try and have a look at this tomorrow, if you can wait. In the mean time, there is an here article on java A* implementations.
 
Clancey Tanglefoot
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, thanks allot for the replies. Sorry for the ugly code post, I'm new to the forums and didn't know how to best paste the code in. The article seems to be very informative, thank you. I know my issue lies in my lack of experience with java, rather than my understanding of the alogrithm. This certainly helps close the gap. Thanks!
 
Let me tell you a story about a man named Jed. He made this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic