Big-O Notations Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

For Arrays?

A
  • traverse all spots = O(N)
  • search for an item = O(N) or O(Log2N)
  • removed any item location unknown = O(N)
  • get any item location unknown = O(1)
  • add item at the end = O(1)
  • add item at the front = O(N)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

For Single Linked Lists?

A
  • traverse all nodes = O(N)
  • search for an item = O(N)
  • remove any item location unknown = O(N)
  • get any item location unknown = O(N)
  • add item at the end O(N)
  • add item at the front = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

For Double Linked List?

A
  • traverse all nodes = O(N)
  • search for an item = O(N)
  • remove any item location unknown = O(N)
  • get any item location unknown = O(N)
  • add item at the end = O(1)
  • add item at the front = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

For Binary Search Tree

A
  • traverse all nodes = O(N)
  • search for an item = O(log2N)
  • remove any item location unknown = O(log2N)
  • get any item location unknown = O(log2N)
  • add item at the end = O(log2N)
  • add item at the front = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

For ArrayList?

A
  • traverse all spots = O(N)
  • search for an item = O(N) or O(log2N)
  • remove any item location unknown = O(N)
  • get any item location unknown = O(1)
  • add item at the end = O(1)
  • add item at the front = O(N)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

For LinkedList?

A
  • traverse all spots = O(N)
  • search for an item = O(N)
  • remove any item location unknown = O(N)
  • get any item location unknown = O(N)
  • add item at the end = O(1)
  • add item at the front = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

For TreeSets?

A
  • add() = O(log2N)
  • get() = O(log2N)
  • containsKey() = O(log2N)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

For HashSets?

A
  • add() = O(1)
  • get() = O(1)
  • containsKey() = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

For TreeMap?

A
  • put() = O(log2N)
  • get() = O(log2N)
  • containsKey() = O(log2N)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

For Hash Map?

A
  • put() = O(1)
  • get() = O(1)
  • containsKey() = O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly