Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-797

An indexed, doubly-linked list data structure running some operations in O(sqrt(n)) time instead of O(n)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Collection

    Description

      (The data structure in question lives in GitHub.)

       

      IndexedLinkedList, according to discussion on the mailing list, runs most operations faster than  TreeList, while still having smaller memory fingerprint: in TreeList, for each element there are 3 references, 2 ints and 2 booleans. In IndexedLinkedList, for each element there is only 3 references. (Also, IndexedLinkedList maintains ceil(sqrt(N)) so called "fingers", each consisting of a reference to a linked list node Node and an int value being the appearance index of Node.)

       

      What comes to the implemented interfaces, they are Deque, List, Cloneable and Serializable. All four are implemented fully in accordance to JDK 18.

      Attachments

        1. RemoveFromEnd.png
          15 kB
          Rodion Efremov
        2. RemoveFromBeginning.png
          15 kB
          Rodion Efremov
        3. RemoveAtRandom.png
          14 kB
          Rodion Efremov
        4. IterateAndModify.png
          14 kB
          Rodion Efremov
        5. Iterate.png
          12 kB
          Rodion Efremov
        6. GetAtRandom.png
          12 kB
          Rodion Efremov
        7. AddAtRandom.png
          11 kB
          Rodion Efremov
        8. AddAtEnd.png
          12 kB
          Rodion Efremov
        9. AddAtBeginning.png
          14 kB
          Rodion Efremov

        Activity

          People

            Unassigned Unassigned
            coderodde Rodion Efremov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: