You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LinkedHashMap is currently implemented using a combination of map and Doubly Linked List but takes O(n) time to remove an element. The implementation should use a reference to the node in the doubly linked list where the element is stored and should be removed in O(1). Also, the remove method first tries to find the index in O (n) and then remove the element in O(n). It can be easily optimized to do it in O(n).
The text was updated successfully, but these errors were encountered:
LinkedHashMap is currently implemented using a combination of map and Doubly Linked List but takes O(n) time to remove an element. The implementation should use a reference to the node in the doubly linked list where the element is stored and should be removed in O(1). Also, the remove method first tries to find the index in O (n) and then remove the element in O(n). It can be easily optimized to do it in O(n).
The text was updated successfully, but these errors were encountered: