Array-based Linked List: How to deamortize deletion? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag? The Ask Question Wizard is Live!Create ArrayList from arrayHow do I check if an array includes an object in JavaScript?Difference between append vs. extend list methods in PythonHow to append something to an array?PHP: Delete an element from an arrayHow to insert an item into an array at a specific index (JavaScript)?Loop through an array in JavaScriptHow to check if an object is an array?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?

Why did the rest of the Eastern Bloc not invade Yugoslavia?

Why did the IBM 650 use bi-quinary?

51k Euros annually for a family of 4 in Berlin: Is it enough?

Should I discuss the type of campaign with my players?

Extract all GPU name, model and GPU ram

Using et al. for a last / senior author rather than for a first author

Echoing a tail command produces unexpected output?

At the end of Thor: Ragnarok why don't the Asgardians turn and head for the Bifrost as per their original plan?

Is it true that "carbohydrates are of no use for the basal metabolic need"?

What's the purpose of writing one's academic biography in the third person?

How do I stop a creek from eroding my steep embankment?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Seeking colloquialism for “just because”

How does the particle を relate to the verb 行く in the structure「A を + B に行く」?

Why was the term "discrete" used in discrete logarithm?

Book where humans were engineered with genes from animal species to survive hostile planets

How to call a function with default parameter through a pointer to function that is the return of another function?

porting install scripts : can rpm replace apt?

What is the role of the transistor and diode in a soft start circuit?

Storing hydrofluoric acid before the invention of plastics

Can a non-EU citizen traveling with me come with me through the EU passport line?

Identify plant with long narrow paired leaves and reddish stems

When do you get frequent flier miles - when you buy, or when you fly?

How to bypass password on Windows XP account?



Array-based Linked List: How to deamortize deletion?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?
The Ask Question Wizard is Live!Create ArrayList from arrayHow do I check if an array includes an object in JavaScript?Difference between append vs. extend list methods in PythonHow to append something to an array?PHP: Delete an element from an arrayHow to insert an item into an array at a specific index (JavaScript)?Loop through an array in JavaScriptHow to check if an object is an array?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















Suppose we implement a linked list using an array. Let's say each element consists of a key and the index of the next item.



Now insertion and deletion are O(1) amortized, if I'm not mistaken. If the array becomes full or too empty, we need to allocate a new one of double or half the size.



We could deamortize insertion by using a resizable array as specified in Resizable Arrays in Optimal Time and Space. In short, instead of one huge array we have smaller arrays, and as the data set grows, smaller arrays are gradually transformed into larger arrays. It has some pretty neat bounds on the running time of each operation.



But now, how might we deamortize deletion?



This is as far as I got: We can maintain a "free-list". Besides the regular "head" index, we would track the first free index, which in turn points to the next free index, and so on. Basically, the structure consists of two intermingled linked lists, namely the data list and the free list.



However, after a lot of deletions, we could be sitting with an array full of "holes". Rebuilding the entire thing to half-size all at once might not be feasible for large data sets.



Can we deamortize deletion?










share|improve this question




























    1















    Suppose we implement a linked list using an array. Let's say each element consists of a key and the index of the next item.



    Now insertion and deletion are O(1) amortized, if I'm not mistaken. If the array becomes full or too empty, we need to allocate a new one of double or half the size.



    We could deamortize insertion by using a resizable array as specified in Resizable Arrays in Optimal Time and Space. In short, instead of one huge array we have smaller arrays, and as the data set grows, smaller arrays are gradually transformed into larger arrays. It has some pretty neat bounds on the running time of each operation.



    But now, how might we deamortize deletion?



    This is as far as I got: We can maintain a "free-list". Besides the regular "head" index, we would track the first free index, which in turn points to the next free index, and so on. Basically, the structure consists of two intermingled linked lists, namely the data list and the free list.



    However, after a lot of deletions, we could be sitting with an array full of "holes". Rebuilding the entire thing to half-size all at once might not be feasible for large data sets.



    Can we deamortize deletion?










    share|improve this question
























      1












      1








      1








      Suppose we implement a linked list using an array. Let's say each element consists of a key and the index of the next item.



      Now insertion and deletion are O(1) amortized, if I'm not mistaken. If the array becomes full or too empty, we need to allocate a new one of double or half the size.



      We could deamortize insertion by using a resizable array as specified in Resizable Arrays in Optimal Time and Space. In short, instead of one huge array we have smaller arrays, and as the data set grows, smaller arrays are gradually transformed into larger arrays. It has some pretty neat bounds on the running time of each operation.



      But now, how might we deamortize deletion?



      This is as far as I got: We can maintain a "free-list". Besides the regular "head" index, we would track the first free index, which in turn points to the next free index, and so on. Basically, the structure consists of two intermingled linked lists, namely the data list and the free list.



      However, after a lot of deletions, we could be sitting with an array full of "holes". Rebuilding the entire thing to half-size all at once might not be feasible for large data sets.



      Can we deamortize deletion?










      share|improve this question














      Suppose we implement a linked list using an array. Let's say each element consists of a key and the index of the next item.



      Now insertion and deletion are O(1) amortized, if I'm not mistaken. If the array becomes full or too empty, we need to allocate a new one of double or half the size.



      We could deamortize insertion by using a resizable array as specified in Resizable Arrays in Optimal Time and Space. In short, instead of one huge array we have smaller arrays, and as the data set grows, smaller arrays are gradually transformed into larger arrays. It has some pretty neat bounds on the running time of each operation.



      But now, how might we deamortize deletion?



      This is as far as I got: We can maintain a "free-list". Besides the regular "head" index, we would track the first free index, which in turn points to the next free index, and so on. Basically, the structure consists of two intermingled linked lists, namely the data list and the free list.



      However, after a lot of deletions, we could be sitting with an array full of "holes". Rebuilding the entire thing to half-size all at once might not be feasible for large data sets.



      Can we deamortize deletion?







      arrays data-structures linked-list amortization






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 17:32









      TimoTimo

      3,26822636




      3,26822636






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068230%2farray-based-linked-list-how-to-deamortize-deletion%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068230%2farray-based-linked-list-how-to-deamortize-deletion%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко