Rodion Efremov created COLLECTIONS-797:
------------------------------------------

             Summary: An indexed, doubly-linked list data structure running 
some operations in O(sqrt(n)) time instead of O(n)
                 Key: COLLECTIONS-797
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-797
             Project: Commons Collections
          Issue Type: Improvement
          Components: Collection
            Reporter: Rodion Efremov


The data structure in question lives in 
[GitHub|https://github.com/coderodde/LinkedList].

 

The idea is that we maintain sqrt(N/2) so called "fingers" along the actual 
list. Each finger contains a reference to a list node and an index of that 
node. Now, when we need to access a node via an index, we don't have to scan 
through the entire linked list, but, instead, only consult all the finger, 
choose the closest finger, and iterate from the respective node towards the 
target node. 

 

If the fingers are distributely evenly, also traversal from the node pointed by 
a finger to the target node will require O(sqrt(N)) time.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to