Data structures¶
-
Lists
Array, list or any indexed collection of elements.
-
Queues
Queue, stack or any FIFO or LIFO collection of elements.
-
Sets
Set or any collection of unique elements.
-
Maps
Map, dictionary or any collection of key-value pairs.
Performance overview¶
Data structure | Access | Search | Insert | Delete |
---|---|---|---|---|
Lists | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) |
Queues | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) |
Sets | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{black} \fcolorbox{gold}{yellow} {Θ(n)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) |
Maps | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{white} \fcolorbox{limegreen}{forestgreen} {O(1)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) | \(\color{white} \fcolorbox{limegreen}{forestgreen} {Θ(1)}\) → \(\color{black} \fcolorbox{gold}{yellow} {O(n)}\) |