0

I'm working on a C project which defines a hash.h header, containing an intrusive hash structure and its interface, as well as a list.h header containing an intrusive list and its interface.

The hash is implemented using lists, and there are no other data structures available to support the hash's implementation, so abstraction isn't worth very much in this context.

So leaving abstraction aside, is there any advantage of using an intrusive hash instead of an intrusive list?

bsky
  • 19,326
  • 49
  • 155
  • 270

1 Answers1

1

Finding an object in a list is O(N), finding an object in a hash is O(1) or O(log n) depending on the hash implementation.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278