Arrays Flashcards

1
Q

What is an array?

A

Arrays are a data structure that hold the same type of data in contiguous memory locations.

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

What is a subarray?

A

A range of contiguous values within an array.
For example
[1,2,3,4]
a subarray is [2,3]

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

What is a subsequent in an array?

A

A sequence is derived from the given sequence by deleting some or no elements without changing the oder of the remaining element.

given an array [2, 3, 6, 1, 5, 4], [3, 1, 5] is a subsequence but [3, 5, 1] is not a subsequence.

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

What is the time complexity of an array
?

A

Search is O(n), if it is sorted then O(log(n))
slicing takes O(n)

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

What are should you do during in a interview if there you are given an array?

A

Clarify if there are duplicates, if so would it make it easier or harder question.

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

What are the array corner cases?

A

Empty Sequence
Sequence of 1 or 2 elements
Sequences with repeated elements
Duplicate values in the sequence

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