This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
erdelf
wrote ...
2014/4/3
Distance list sorting
erdelf
2014/4/3
#
Is there a way to sort a list with actors after the distance to another Actor and return the one with the shortest distance and all that efficiently enough to work without much lag in the act method cycles`?
bourne
2014/4/3
#
Do you need to actually sort a list to retrieve the closest Actor?
erdelf
2014/4/3
#
not really, i just need the closest Actor out of a List
bourne
2014/4/3
#
Then you should be able to do it in O(n) time. No different than finding the min/max of a list.
erdelf
2014/4/3
#
yeah thx, i think i am too tired to code right now
You need to login to post a reply.
X