Array Flashcards

1
Q

Accessing a value at a given index?

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Updating a value at a given index?

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Inserting a value at the beginning?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Inserting a value in the middle?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Inserting a value at the end? (2)

A

Dynamic Arrays: Amortised O(1)

Static Arrays: O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Removing a value at the beginning?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Removing a value in the middle?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Removing a value at the end?

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Copying the array?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Initialising an array?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Traverse an array?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 4 operations of an array that are constant time?

A
  1. Accessing
  2. Updating
  3. Removing at end
  4. Inserting at end (dynamic array only)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the two possible complexities of an arrays operations?

A
  1. O(1)

2. O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

.map?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

.reduce?

A

O(N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly