Thread: LinkedList
View Single Post
Old 12-05-2008, 11:21 AM   #4
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

I was going to write something just like this so excuse me if I nitpick at your implementation a bit:

...ok, I really don't have that much to say, it's pretty neat. There's just a bit many methods, I don't particularly like all those that treat the list as an array by either taking or returning indexes, if you think they're justified that raises the question why doesn't your stack resource submission have them as well. Also, I think you should ditch the getElement method, users shouldn't be able to get a random element from the list like that because all they can do with it is break stuff, since all methods are pretty much meant to be called only on first elements, so getting another list element isn't only dangerous but pretty useless.

call list.AddToListBackOf(9, 2) // List contains: 8, 2, 5, 9, -3 Wouldn't 9 be added two spots after the end of the list, not one?

You could add the less-or-equal and greater-or-equal search types. Also, that stuff should have a public keyword; either that, or make it a static integer in the struct.

There's too much duplication of code in the search function, you could have just a single loop and then an if/elseif statement inside it.

A sort method would be nice to have.
__________________
Anitarf is offline   Reply With Quote