1101. Data Structure - Overview
Data Structure


Overview of common data structures.

1. Data Structure

Data Structure Search Insertion Deletion
Array O(N) O(1) O(N)
Linked List O(N) O(1) O(N)
Binary Tree - - -
Binary Search Tree (average) O(logN) O(logN) O(logN)
Binary Search Tree (worst case) O(N) O(N) O(N)
Red Black Tree O(logN) O(logN) O(logN)
HashMap O(1) O(1) O(1)
  • N is the number of elements.
  • The time complexity of Balanced Search Tree is guaranteed, O(logN).