Linked List vs Any Data Structure
I am storing data in a linked list. Every linked list node contains data,KEY and pointer to the next node. I trying to access the data stored randomly based on the unique KEY. Is there any way by which other data strcture can be used so that search will be faster? pl suggest.
Re: Linked List vs Any Data Structure
Quote:
I am storing data in a linked list. Every linked list node contains data,KEY and pointer to the next node. I trying to access the data stored randomly based on the unique KEY. Is there any way by which other data strcture can be used so that search will be faster? pl suggest.
std::map.
Regards,
Paul McKenzie
Re: Linked List vs Any Data Structure
Quote:
Originally Posted by
Paul McKenzie
std::map.
Or even faster,
std::tr1::unordered_map
It's a so called hash table.