Lesson 4 Flashcards

(17 cards)

1
Q

refers to the use of the std::map or std::unordered_map containers from the Standard Template Library (STL).

A

Map

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

These containers are used to store key-value pairs, where each key is unique, and it maps to a specific value.

A

Map

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

stores elements in a sorted order based on the key. Underlying Data Structure: Typically implemented as a Red-Black Tree.

A

Ordered Map

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

Insert, Delete, Search → O(log n)

A

Ordered Map

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

Does not store elements in any particular order or stores key-value pairs with no specific order.

A

Unordered Maps

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

Average case → O(1) or Worst case → O(n) (rare)

A

Unordered Maps

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

A fundamental data structure in computer science that represents a collection of unique elements with no particular order.

A

Sets

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

are widely used in algorithms and problem-solving due to their efficient membership testing and distinct element properties

A

Sets

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

What are the common operations for sets

A

insert()
erase()
find()
set_union()
set_intersection()
set_difference()
size()
empty()

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

Add a new element to the set

A

insert()

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

Removes an element from the set

A

erase()

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

Checks if an element exists in the set

A

find()

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

Combines two sets

A

set_union

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

Finds the common elements between two sets

A

set_intersection()

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

Finds elements in one set but not in another

A

set_difference()

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

Gets the number of elements in the set

17
Q

Checks if the set is empty