indexing - Linked List with fast node order querying -
We are using a dip linked list data structure to store some unfamiliar data (data such as unarmed , Although the node order is relevant in the link list). A normal operation on this data structure is nodebayrnode (node n1, node n2), which has two node pointers in the list and determines which one of them is second.
This operation takes linear time, because it needs to find the second element to cross the list, which is very slow, to increase this speed, we can add the serial number of each node to the node Has cached within, and refreshed this cache as needed. However, cache refreshing is linear, and operations that alternatively modify the list and the usage of this cache is very slow.
I am looking for suggestions to speed up this behavior. I basically need a data structure that allows all the following functions in continuous or logarithmic time:
- Insertion (after or after the node)
- Delete a node
Apply a modified binary search tree,
struct node {/ * add your data * / node * parent; Node * left; Node * true; }
In which you can use the previous element through a parent pointer and entry, the time of search and deletion is (logn)
Comments
Post a Comment