C++ pointers to be specific. Anyone know much about them?
And where would you use a linked list as opposed to a vector/array?
Faster inserts, but slower element access. When is that good?
Name:
Matrix Glitch2018-06-18 11:21
Anybuddy wanna join my ESCape plan? Engage in thoughtcrime? Turn the tables?
Name:
Anonymous2018-06-18 12:54
pointers are a bit of a pain, but can be faster than array[x] look-ups, and can point to random arrays + probably other interesting stuff
Faster deletes & reordering[?], probably should be self-sorting when stored to disk / copied? It's usually a struct/object/class, so an array of struct with .value and .nextindex is kind of similar. Much faster to concat two linked-lists
Yes. When you need (unordered) insertion in strictly O(1) but don't know the amount of items in your list. Vectors are also O(1) but amortized. Also you could want to fine tune your use of memory (since vectors get expanded every 2^k items, but also depends on your implementation) For example malloc I think used some linked lists and such structures for the whole memory management. Also you can easily turn a linked list into a stack or a FIFO without losing performance.