0% found this document useful (0 votes)
5 views1 page

Data Structures Cheat Sheet

The document is a cheat sheet summarizing the performance characteristics of various data structures including Arrays, Lists, Collections, LinkedLists, Stacks, Queues, and Dictionaries. It provides time complexities for operations such as adding, removing, and accessing elements, highlighting the best and worst case scenarios. The cheat sheet emphasizes the efficiency of memory usage and speed for different data structures based on their implementation and use cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Data Structures Cheat Sheet

The document is a cheat sheet summarizing the performance characteristics of various data structures including Arrays, Lists, Collections, LinkedLists, Stacks, Queues, and Dictionaries. It provides time complexities for operations such as adding, removing, and accessing elements, highlighting the best and worst case scenarios. The cheat sheet emphasizes the efficiency of memory usage and speed for different data structures based on their implementation and use cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

18.05.2025, 14.

40 Data Structures Cheat Sheet

Data Structures Cheat Sheet


[Data Structures I] [Data Structures II] [Data Structures III] [Data Structures IV] [Data Structures Cheat Sheet]

Search
remove remove
add to insert at Random In-order for
from from Notes
end middle Access Access specific
end middle
element

Most efficient
use of
memory; use in
Array O(n) O(n) O(n) O(n) O(1) O(1) O(n) cases where
data size is
fixed.

best
case Implementation
is optimized for
O(1); speed. In many
List<T> O(1) O(n) O(n) O(1) O(1) O(n) cases, List will
worst be the best
case choice.
O(n)

best
case List is a better
O(1); choice, unless
Collection<T> O(1) O(n) O(n) O(1) O(1) O(n) publicly
worst exposed as
case API.

O(n)

Many
operations are
LinkedList<T> O(1) O(1) O(1) O(1) O(n) O(1) O(n) fast, but watch
out for cache
coherency.

best
case Shouldn't be
selected for
O(1); performance
Stack<T> O(1) N/A N/A N/A N/A N/A reasons, but
worst algorithmic
case ones.
O(n)

best
case Shouldn't be
selected for
O(1); performance
Queue<T> O(1) N/A N/A N/A N/A N/A reasons, but
worst algorithmic
case ones.
O(n)

Although in-
best best order access
time is
case case constant time,
O(1); O(1); it is usually
Dictionary<K,T> O(1) O(1) O(1)* O(1)* O(1) slower than
worst worst other
case case structures due
to the over-
O(n) O(n) head of looking
up the key.

https://www.clear.rice.edu/comp160/data_cheat.html 1/1

You might also like