| Name | Insert | Access | Search | Delete | Comments |
|---|---|---|---|---|---|
| Array | O(n) | O(1) | O(n) | O(n) | Insertion to the end is O(1). Details here. |
| (Hash)Map | O(1)* | O(1)* | O(1)* | O(1)* | Rehashing might affect insertion time. Details here. |
| Map (using Binary Search Tree) | O(log(n)) | - | O(log(n)) | O(log(n)) | Implemented using Binary Search Tree |
| Set (using HashMap) | O(1)* | - | O(1)* | O(1)* | Set using a HashMap implementation. Details here. |
| Set (using list) | O(n) | - | O(n)] | O(n) | Implemented using Binary Search Tree |
| Set (using Binary Search Tree) | O(log(n)) | - | O(log(n)) | O(log(n)) | Implemented using Binary Search Tree |
| Linked List (singly) | O(n) | - | O(n) | O(n) | Adding/Removing to the start of the list is O(1). Details here. |
| Linked List (doubly) | O(n) | - | O(n) | O(n) | Adding/Deleting from the beginning/end is O(1). But, deleting/adding from the middle is O(n). Details here |
| Stack (array implementation) | O(1) | - | - | O(1) | Insert/delete is last-in, first-out (LIFO) |
| Queue (naive array impl.) | O(n) | - | - | O(1) | Insert (Array.shift) is O(n) |
| Queue (array implementation) | O(1)* | - | - | O(1) | Worst time insert is O(n). However amortized is O(1) |
| Queue (list implementation) | O(1) | - | - | O(1) | Using Doubly Linked List with reference to the last element. |
