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?

25
Is the size fixed or dynamic for ArrayLists (no order)? BigO if dynamic?
Dynamic. BigO: O(n) - auto resize the ArrayList
26
Is the size fixed or dynamic for ArrayLists (ordered)? BigO if dynamic?
Dynamic. BigO: O(n) - auto resize the ArrayList
27
Is the size fixed or dynamic for LinkedLists (no order)? BigO if dynamic?
Dynamic. BigO: O(1)
28
Is the size fixed or dynamic for LinkedLists (ordered)? BigO if dynamic?
Dynamic. BigO: O(1)
29
Is the size fixed or dynamic for Stacks? BigO if dynamic?
Dynamic. BigO: O(1)
30
Is the size fixed or dynamic for Queues? BigO if dynamic?
Dynamic. BigO: O(1)
31
Is the size fixed or dynamic for Binary Trees? BigO if dynamic?
Dynamic. BigO: O(1)
32
Is the size fixed or dynamic for HashSets? BigO if dynamic?
Dynamic. Auto resize. BigO: O(n) - bucket resizing
33
Is the size fixed or dynamic for Heaps? BigO if dynamic?
Dynamic. Might need to resize if full. BigO: O(n)
34
Can you add an item at any location for Arrays (no order)? BigO?
Yes, until the array is full. BigO: O(n)
35
Can you add an item at any location for a ArrayLists (no order)? BigO?
Yes. BigO: O(n)
36
Can you add an item at any location for ArrayLists (ordered)? BigO?
Yes. BigO: O(n)
37
Can you add an item at any location for LinkedLists (no order)? BigO?
Yes. BigO: O(1)
38
Can you add an item at any location for LinkedLists (ordered)? BigO?
Yes. BigO: O(1)
39
Can you add an item at any location for Stacks? BigO?
Yes. BigO: O(1)
40
Can you add an item at any location for Queues? BigO?
Yes. BigO: O(1)
41
Can you add an item at any location for Binary Trees? BigO?
Yes. BigO: O(1)
42
Can you add an item at any location for HashSets? BigO?
Yes. BigO: O(1)
43
Can you add an item at any location for Heaps? BigO?
Yes. BigO: O(logN) - needs to be reordered
44
Can you remove an item once it has been found for Arrays (no order)? BigO?
Yes. BigO: O(n) - items need to shift
45
Can you remove an item once it has been found for ArrayList (no order)? BigO?
Yes. BigO: O(n) - items need to shift
46
Can you remove an item once it has been found for ArrayList (ordered)? BigO?
Yes. BigO: O(n) - items need to shift
47
Can you remove an item once it has been found for LinkedList (no order)? BigO?
Yes. BigO: O(1)
48
Can you remove an item once it has been found for LinkedList (ordered)? BigO?
Yes. BigO: O(1)
49
Can you remove an item once it has been found for Stacks? BigO?
Yes. BigO: O(1)
50
Can you remove an item once it has been found for Queues? BigO?
Yes. BigO: O(1)
51
Can you remove an item once it has been found for Binary Trees? BigO?
Yes. BigO: O(log N) - need to find the node
52
Can you remove an item once it has been found for HashSets? BigO?
Yes. BigO: O(1)
53
Can you remove an item once it has been found for Heaps? BigO?
Yes. BigO: O(log N) - Reorder is required
54
Do Sets have duplicate properties?
No
55
Do Sets have the notion of position?
No. You cannot ask for the first element of a set.
56
Maps do not allow duplicate keys
True
57
Maps do not allow duplcate values
False