Why deletion of elements of hash table using doubly-linked list is O(1)?

前端 未结 8 1335
野的像风
野的像风 2020-12-23 10:20

On CLRS\'s textbook \"Introduction to Algorithm\", there\'s such paragraph on pg. 258.

We can delete an element in O(1) time if the lists are doubly linked. (Note th

8条回答
  •  萌比男神i
    2020-12-23 10:57

    suppose you want to delete an element x , by using doubly link list you can easily connect the previous element of x to next element of x. so no need to go through all the list and it will be in O(1).

提交回复
热议问题