Big O Notations - Data Structures Flashcards
1
Q
Array
A
Average Case: Access: Θ(1) Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Worst Case Access: Θ(1) Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(n)
2
Q
Stack
A
Average Case: Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Space (worst case): Θ(n)
3
Q
Queue
A
Average Case: Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Space (worst case): Θ(n)
4
Q
Singly-Linked List
A
Average Case: Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Space (worst case): Θ(n)
5
Q
Doubly-Linked List
A
Average Case: Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(1) Deletion: Θ(1)
Space (worst case): Θ(n)
6
Q
Skip List
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(log(n))
7
Q
Hash Table (Dictionary)
A
Average Case: Access: N/A Search: Θ(1) Insertion: Θ(1) Deletion: Θ(1)
Worst Case Access: N/A Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(n)
8
Q
Binary Search Tree
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(n)
9
Q
Cartesian Tree
A
Average Case: Access: N/A Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case Access: N/A Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(n)
10
Q
B-Tree
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Space (worst case): Θ(n)
11
Q
Red-Black Tree
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Space (worst case): Θ(n)
12
Q
Splay Tree
A
Average Case: Access: N/A Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case: Access: N/A Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Space (worst case): Θ(n)
13
Q
AVL Tree
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Space (worst case): Θ(n)
14
Q
KD Tree
A
Average Case: Access: Θ(log(n)) Search: Θ(log(n)) Insertion: Θ(log(n)) Deletion: Θ(log(n))
Worst Case Access: Θ(n) Search: Θ(n) Insertion: Θ(n) Deletion: Θ(n)
Space (worst case): Θ(n)