DSA Flashcards

1
Q

Which data structures support random access?

A

Arrays (no order), ArrayLists (no order), ArrayLists (ordered)

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

Which data structures do not support random access?

A

LinkedLists (ordered and unordered), Stacks, Queues, Binary Trees, HashSets, Heaps

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

What is the BigO notation for adding items to a Binary Tree

A

O(logn)

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

Type of Ordering for an Array (no order)

A

None

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

Type of Ordering for an ArrayList (no order)

A

None

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

Type of Ordering for an ArrayList (ordered)

A

User Defined

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

Type of Ordering for a LinkedList (no order)

A

None

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

Type of Ordering for a LinkedList (ordered)

A

User defined

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

Type of Ordering for a Stack

A

Data Structure defined (LIFO)

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

Type of Ordering for a Queue

A

Data Structure defined (FIFO)

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

Type of Ordering for a Binary Tree

A

User defined

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

Type of Ordering for a HashSet

A

None

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

Type of Ordering for a Heap

A

User defined for the Top only

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

What type of search is supported for Arrays (no order? What is the BigO?

A

Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for

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

What type of search is supported for ArrayLists (no order) ? What is the BigO?

A

Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for

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

What type of search is supported for ArrayLists (ordered) ? What is the BigO?

A

Type: Binary BigO: O(logN) - it divides the search in half with each iteration

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

What type of search is supported for LinkedLists (no order) ? What is the BigO?

A

Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for

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

What type of search is supported for LinkedLists (ordered) ? What is the BigO?

A

Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for

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

What type of search is supported for Stacks ? What is the BigO?

A

Type: Search is not supported. You can only look at the top of the Stack.

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

What type of search is supported for Queues? What is the BigO?

A

Type: Search is not supported. You can only look at the front of the Queue.

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

What type of search is supported for Binary Trees? What is the BigO?

A

Type: Binary BigO: O(logN) - it divides the search in half with each iteration

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

What type of search is supported for HashSets? What is the BigO?

A

Type: Lookup BigO: O(1) - it goes straight to the bucket and looks only in that bucket

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

What type of search is supported for Heaps? What is the BigO?

A

Type: Search is not supported. You can only look at the top of the Heap. BigO: O(1)

24
Q

Is the size fixed or dynamic for Arrays (no order)? BigO if dynamic?

A

Fixed

25
Q

Is the size fixed or dynamic for ArrayLists (no order)? BigO if dynamic?

A

Dynamic. BigO: O(n) - auto resize the ArrayList

26
Q

Is the size fixed or dynamic for ArrayLists (ordered)? BigO if dynamic?

A

Dynamic. BigO: O(n) - auto resize the ArrayList

27
Q

Is the size fixed or dynamic for LinkedLists (no order)? BigO if dynamic?

A

Dynamic. BigO: O(1)

28
Q

Is the size fixed or dynamic for LinkedLists (ordered)? BigO if dynamic?

A

Dynamic. BigO: O(1)

29
Q

Is the size fixed or dynamic for Stacks? BigO if dynamic?

A

Dynamic. BigO: O(1)

30
Q

Is the size fixed or dynamic for Queues? BigO if dynamic?

A

Dynamic. BigO: O(1)

31
Q

Is the size fixed or dynamic for Binary Trees? BigO if dynamic?

A

Dynamic. BigO: O(1)

32
Q

Is the size fixed or dynamic for HashSets? BigO if dynamic?

A

Dynamic. Auto resize. BigO: O(n) - bucket resizing

33
Q

Is the size fixed or dynamic for Heaps? BigO if dynamic?

A

Dynamic. Might need to resize if full. BigO: O(n)

34
Q

Can you add an item at any location for Arrays (no order)? BigO?

A

Yes, until the array is full. BigO: O(n)

35
Q

Can you add an item at any location for a ArrayLists (no order)? BigO?

A

Yes. BigO: O(n)

36
Q

Can you add an item at any location for ArrayLists (ordered)? BigO?

A

Yes. BigO: O(n)

37
Q

Can you add an item at any location for LinkedLists (no order)? BigO?

A

Yes. BigO: O(1)

38
Q

Can you add an item at any location for LinkedLists (ordered)? BigO?

A

Yes. BigO: O(1)

39
Q

Can you add an item at any location for Stacks? BigO?

A

Yes. BigO: O(1)

40
Q

Can you add an item at any location for Queues? BigO?

A

Yes. BigO: O(1)

41
Q

Can you add an item at any location for Binary Trees? BigO?

A

Yes. BigO: O(1)

42
Q

Can you add an item at any location for HashSets? BigO?

A

Yes. BigO: O(1)

43
Q

Can you add an item at any location for Heaps? BigO?

A

Yes. BigO: O(logN) - needs to be reordered

44
Q

Can you remove an item once it has been found for Arrays (no order)? BigO?

A

Yes. BigO: O(n) - items need to shift

45
Q

Can you remove an item once it has been found for ArrayList (no order)? BigO?

A

Yes. BigO: O(n) - items need to shift

46
Q

Can you remove an item once it has been found for ArrayList (ordered)? BigO?

A

Yes. BigO: O(n) - items need to shift

47
Q

Can you remove an item once it has been found for LinkedList (no order)? BigO?

A

Yes. BigO: O(1)

48
Q

Can you remove an item once it has been found for LinkedList (ordered)? BigO?

A

Yes. BigO: O(1)

49
Q

Can you remove an item once it has been found for Stacks? BigO?

A

Yes. BigO: O(1)

50
Q

Can you remove an item once it has been found for Queues? BigO?

A

Yes. BigO: O(1)

51
Q

Can you remove an item once it has been found for Binary Trees? BigO?

A

Yes. BigO: O(log N) - need to find the node

52
Q

Can you remove an item once it has been found for HashSets? BigO?

A

Yes. BigO: O(1)

53
Q

Can you remove an item once it has been found for Heaps? BigO?

A

Yes. BigO: O(log N) - Reorder is required

54
Q

Do Sets have duplicate properties?

A

No

55
Q

Do Sets have the notion of position?

A

No. You cannot ask for the first element of a set.

56
Q

Maps do not allow duplicate keys

A

True

57
Q

Maps do not allow duplcate values

A

False