Results 1 to 6 of 6
- 04-23-2010, 03:14 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 46
- Rep Power
- 0
-
Sometimes a hash (such as a HashMap would be better). But given your two choices, which do you think would be better, and then let's discuss it. :)
- 04-23-2010, 03:25 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 46
- Rep Power
- 0
Well I think linked implementation would be better since you can do like list.add or remove or get indexOf size() to the List ADT - and things like that to it.
Last edited by bdario1; 04-23-2010 at 03:29 AM.
-
Think of how you'd access random items on a linked list -- starting at the head and then walking through the list til you reach the item of interest, vs how you'd access a random item in an array -- get an index and then use it to scoop up the item of interest.
- 04-23-2010, 03:35 AM #5
Member
- Join Date
- Mar 2010
- Posts
- 46
- Rep Power
- 0
So basically array seems to be better right? it seems faster since you can check left and right of the index and move the way you want and keep doing it until you get to your desired location. As with list you would have to go through every element before you get to it right?
- 04-23-2010, 11:00 AM #6
Similar Threads
-
array-based implementation question
By intelli in forum New To JavaReplies: 1Last Post: 04-18-2009, 05:18 PM -
n00b: linked list question
By ankitmcgill in forum New To JavaReplies: 2Last Post: 03-13-2009, 04:15 AM -
[SOLVED] Linked list question
By ztrath in forum New To JavaReplies: 8Last Post: 03-11-2009, 11:38 PM -
Linked List Question
By CirKuT in forum New To JavaReplies: 4Last Post: 12-10-2008, 06:56 PM -
question about linked lists
By jkurth in forum Advanced JavaReplies: 1Last Post: 11-11-2007, 08:33 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks