Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name this data structure?

I have a data structure that supports following operations:

  1. An item can be inserted in constant time. For that item the data structure assigns a unique positive integer. (Clarification: assigned integer is not a function of inserted item, and user has no choice on the assigned integer. It is chosen solely by the data structure.)
  2. Using that integer the item can be found in constant time.
  3. Using that integer the item can be removed in constant time.

It is implemented using an array of pointers where the assigned integers are indices where the items are stored. Unused indices are chained up in linked-list fashion for constant time insertion.

What is/should be the name of such data structure?

like image 207
Akash Rawal Avatar asked Aug 01 '26 19:08

Akash Rawal


1 Answers

It's an array with a "free list."

like image 132
John Zwinck Avatar answered Aug 06 '26 04:08

John Zwinck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!