a hash table or a binary search tree is faster lookup than a linked list
an expanding array (vector) uses less space than a linked list
50% Packetloss - Thu Sep 02, 2004 12:48 am
Post subject:
It depends on what you are doing, if you have an unknown number of "items" that you have to keep track of, then linklist might be the best solution. Arrays are fast but not if you have to keep allocating/deallocating memory to fit everything in it. We are talking about a PC, a bot using a linklist isnt exactly going to take up cpu cycles unless you are managing a huge amount of data. Huge amounts of data should be handled efficiently by mysql or something, you cant have a lot of data taking up memory.
Cyan~Fire - Thu Sep 02, 2004 6:19 am
Post subject:
Vectors take longer appending data and linkedlists take longer accessing data. So basically, you should almost always use vectors unless you're constantly adding/deleting objects.
CypherJF - Thu Sep 02, 2004 10:06 am
Post subject:
Shrug, for bot's, I just use w/e works... :-p
Bak - Fri Sep 03, 2004 1:31 pm
Post subject:
vectors shouldn't take longer appending data on average.
Cyan~Fire - Fri Sep 03, 2004 2:17 pm
Post subject:
Why not? With a vector, even when you have extra allocated space, you're still going to have to reallocate and copy some later. With a linkedlist, you just keep on appending items or changing some pointers to insert.