Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps you need to think a little deeper on the implementation of linked lists. You indicate that lazy deletion would NOT help in any way because the time to search is all the time that is necessary to perform the delete.</p> <p>Think about what it takes to actually REMOVE an item from a linked list. note: this assumes a SINGLY linked list (not a double linked list) 1) Find the item to delete (because this is a SINGLE linked list, you always have to search, because you need the PREV item) 2) Keep pointers to the PREV and NEXT elements 3) Fix the "PREV" element to point to the NEXT element - thus, isolating the CURRENT element 3.5) in a double linked list, you also have to take care of the NEXT element pointing back to the PREV element. 4) Release the memory associated with CURRENT element</p> <p>Now, what is the process for a lazy delete? --- much shorter 1) Find the item to delete (you may not even have to perform a search, as you already have a pointer to the object you want deleted?) 2) mark the item for deletion.</p> <p>*) Wait for "Garbage collection" thread to run and actually perform the remaining steps WHEN the system is "IDLE"</p> <p>A binary tree implemented as a linked list where each element has a left and a right - however, you still perform the same steps in the search. Binary tree searching is just more efficient with O(Log(n)) I believe.</p> <p>However, deleting from these becomes more complex because you have more pointers to deal with (both a "LEFT" and a "RIGHT") - so will take more instructions to fix, especially when you are deleting a tree node that has pointers to nodes for both the left and right -- one of them will need to be promoted to the new root - however, what if they also both already have their left and right pointers assigned? where does the original "left/right" node go? - You have to re-balance the tree at this point. Thus, there is significant savings by mark for delete from a user perspective and having an "idle" garbage collection taking care of the memory details (so the user doesn't have to wait for that).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload