Quickmap, but much better
Use a key-value array with a Doubly-LinkedList
- Add the node to the linked list (var linkedlistnode = linkedlist.insert(node))
- Add the linkedlist node into the array as the key (arr[key] = linkedlistnode)
- Get linkedlistnode from array.
- do linkedlistnode.destroy();
- Loop through linkedlist
Item deletion is expensive. But removing the pointer isnt. Also, why not use a key-value pair?
- Do not insert with a key used before unless you delete it with
delete()
- It wont check duplicates for efficiency - Do not delete a key that has not been inserted. - It wont check if it exsists for efficiency
- Do not get from a key that has not been inserted yet - It wont check for efficiency.